Date: Fri, 14 Mar 1997 18:33:21 +0100 From: Eivind Eklund <eivind@dimaga.com> To: Nate Williams <nate@mt.sri.com> Cc: Nate Williams <nate@freefall.freebsd.org>, CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-sys@freefall.freebsd.org Subject: Re: cvs commit: src/sys/i386/include endian.h Message-ID: <3.0.32.19970314183320.00a52100@dimaga.com>
next in thread | raw e-mail | index | archive | help
At 10:21 AM 3/14/97 -0700, Nate Williams wrote: >> > Branch: sys/i386/include RELENG_2_1_0 >> > Modified: sys/i386/include endian.h >> >> While you're in there, why not reverse the sense of the LINT flag? > >Huh? I have *NO* idea what you're talking about here. If you have code >that explains what you are trying to say. --- /usr/include/machine/endian.h Sun Feb 12 09:31:31 1995 +++ /tmp/endian.h Fri Mar 14 18:31:40 1997 @@ -94,7 +94,7 @@ /* * Macros for network/external number representation conversion. */ -#if BYTE_ORDER == BIG_ENDIAN && !defined(lint) +#if BYTE_ORDER == BIG_ENDIAN || defined(lint) #define ntohl(x) (x) #define ntohs(x) (x) #define htonl(x) (x) @@ -112,9 +112,9 @@ #define htonl __byte_swap_long #define htons __byte_swap_word -#define NTOHL(x) (x) = ntohl((u_long)x) -#define NTOHS(x) (x) = ntohs((u_short)x) -#define HTONL(x) (x) = htonl((u_long)x) -#define HTONS(x) (x) = htons((u_short)x) +#define NTOHL(x) do{(x) = ntohl((u_long)x)}while(0) +#define NTOHS(x) do{(x) = ntohs((u_short)x)}while(0) +#define HTONL(x) do{(x) = htonl((u_long)x)}while(0) +#define HTONS(x) do{(x) = htons((u_short)x)}while(0) #endif #endif /* _MACHINE_ENDIAN_H_ */ The first part is switching the sense of the lint flag, to avoid the GCC specific assembly macros when linting. The second is securing against precedence errors. (I'm keeping my hands away from the include files - that's more than I'm willing to risk breaking.) Eivind Eklund perhaps@yes.no http://maybe.yes.no/perhaps/ eivind@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.32.19970314183320.00a52100>