Skip to content
Snippets Groups Projects
Commit 66253b54 authored by sponcec3's avatar sponcec3 Committed by Steven Murray
Browse files

Fixed compilation in -O2 mode.

This in particular includes fixing the remaining strict-aliasing issues.
parent ef4b216b
Branches
Tags
No related merge requests found
......@@ -486,7 +486,7 @@ char *_Cregexp_reg(int paren, /* Parenthesized? */
char *ret;
char *br;
char *ender;
int parno;
int parno = 0;
int flags;
*flagp = HASWIDTH; /* Tentatively. */
......
......@@ -22,7 +22,6 @@
#define SHORT WORD
/* #define U_SHORT U_WORD */
#define SHORTSIZE WORDSIZE
#define SHORTADDR WORDADDR
#define marshall_WORD marshall_SHORT
#define unmarshall_WORD unmarshall_SHORT
......@@ -76,14 +75,14 @@ typedef char* bitvct; /* bit vector type definition */
*/
#define marshall_BYTE(ptr,n) { BYTE n_ = n; \
(void) memcpy((ptr),BYTEADDR(n_),BYTESIZE); \
INC_PTR(ptr,BYTESIZE); \
(void) memcpy((ptr),&n_,1); \
INC_PTR(ptr,1); \
}
#define unmarshall_BYTE(ptr,n) { BYTE n_ = 0; \
(void) memcpy(BYTEADDR(n_),(ptr),BYTESIZE); \
(void) memcpy(&n_,(ptr),1); \
n = n_; \
INC_PTR(ptr,BYTESIZE); \
INC_PTR(ptr,1); \
}
/*
......@@ -91,12 +90,12 @@ typedef char* bitvct; /* bit vector type definition */
*/
#define marshall_SHORT(ptr,n) { SHORT n_ = htons((unsigned short)(n)); \
(void) memcpy((ptr),SHORTADDR(n_),SHORTSIZE); \
(void) memcpy((ptr),&n_,SHORTSIZE); \
INC_PTR(ptr,SHORTSIZE); \
}
#define unmarshall_SHORT(ptr,n) { SHORT n_ = 0; \
(void) memcpy(SHORTADDR(n_),(ptr),SHORTSIZE); \
(void) memcpy(&n_,(ptr),SHORTSIZE); \
n = ntohs((unsigned short)(n_)); \
if ( BIT_ISSET(ptr,0) && sizeof(SHORT)-SHORTSIZE > 0 ) \
(void) memset((char *)&n,255,sizeof(SHORT)-SHORTSIZE); \
......@@ -108,12 +107,12 @@ typedef char* bitvct; /* bit vector type definition */
*/
#define marshall_LONG(ptr,n) { LONG n_ = htonl((unsigned long)(n)); \
(void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
(void) memcpy((ptr),&n_,LONGSIZE); \
INC_PTR(ptr,LONGSIZE); \
}
#define unmarshall_LONG(ptr,n) { LONG n_ = 0; \
(void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
(void) memcpy(&n_,(ptr),LONGSIZE); \
n = ntohl((unsigned long)(n_)); \
if ( BIT_ISSET(ptr,0) && sizeof(LONG)-LONGSIZE > 0 ) \
(void) memset((char *)&n,255,sizeof(LONG)-LONGSIZE); \
......@@ -148,23 +147,22 @@ EXTERN_C int _unmarshall_STRINGN (char **, char*, int);
*/
#define marshall_HYPER(ptr,n) { U_HYPER u_ = n; \
LONG n_ = htonl(*((U_LONG *)((char *)&(u_)+LONGSIZE))); \
(void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
U_LONG n_ = htonl((U_LONG)u_); \
(void) memcpy((ptr),&n_,LONGSIZE); \
INC_PTR(ptr,LONGSIZE); \
n_ = htonl(*((U_LONG *)&(u_))); \
(void) memcpy((ptr),LONGADDR(n_),LONGSIZE); \
n_ = htonl((U_LONG)(u_ >> 32)); \
(void) memcpy((ptr),&n_,LONGSIZE); \
INC_PTR(ptr,LONGSIZE); \
}
#define unmarshall_HYPER(ptr,n) { U_HYPER u_ = 0; \
LONG n_ = 0; \
(void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
*((LONG *)((char *)&(u_)+LONGSIZE)) = \
ntohl((U_LONG)(n_)); \
U_LONG n_ = 0; \
(void) memcpy(&n_,(ptr),LONGSIZE); \
u_ = ntohl(n_); \
INC_PTR(ptr,LONGSIZE); \
n_ = 0; \
(void) memcpy(LONGADDR(n_),(ptr),LONGSIZE); \
*((LONG *)&(u_)) = ntohl((U_LONG)(n_)); \
(void) memcpy(&n_,(ptr),LONGSIZE); \
u_ |= (((U_HYPER)ntohl(n_)) << 32); \
INC_PTR(ptr,LONGSIZE); \
n = u_; \
}
......
......@@ -19,7 +19,6 @@
* Data representation
*/
#define BYTESIZE 1
#define WORDSIZE 2
#define LONGSIZE 4
#define QUADSIZE 8
......@@ -33,10 +32,6 @@ typedef char BYTE;
typedef short WORD;
typedef int LONG;
#define BYTEADDR(x) (((char *)&(x))+sizeof(BYTE)-BYTESIZE)
#define WORDADDR(x) (((char *)&(x))+sizeof(WORD)-WORDSIZE)
#define LONGADDR(x) (((char *)&(x))+sizeof(LONG)-LONGSIZE)
typedef long long signed64;
typedef unsigned long long u_signed64;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment