diff options
author | grr <grr@cvs.openbsd.org> | 1997-06-25 12:41:44 +0000 |
---|---|---|
committer | grr <grr@cvs.openbsd.org> | 1997-06-25 12:41:44 +0000 |
commit | 9f5b8216c2af91286d9d2beb109f93ce776885ca (patch) | |
tree | 2087060e25e41ca681c1d46bbda6f343b05d4715 /sys/arch/sparc/include/endian.h | |
parent | c572c52a5526fc9e50a8fec655bd2d43eb2b7aa9 (diff) |
Sigh, Revert changes to endian.h - it was all confusion due to incorrect
usage in new ip_* code, since fixed. Added usage notes to prevent future
confusion in this regard.
Diffstat (limited to 'sys/arch/sparc/include/endian.h')
-rw-r--r-- | sys/arch/sparc/include/endian.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/arch/sparc/include/endian.h b/sys/arch/sparc/include/endian.h index a899e0cea2f..c536790f9ef 100644 --- a/sys/arch/sparc/include/endian.h +++ b/sys/arch/sparc/include/endian.h @@ -1,4 +1,4 @@ -/* $OpenBSD: endian.h,v 1.5 1997/06/24 18:15:02 grr Exp $ */ +/* $OpenBSD: endian.h,v 1.6 1997/06/25 12:41:42 grr Exp $ */ /* $NetBSD: endian.h,v 1.3 1996/02/13 17:04:58 christos Exp $ */ /* @@ -66,6 +66,13 @@ __END_DECLS /* * Macros for network/external number representation conversion. + * + * The way this works is that HTONS(x) modifies x and *can't* be used as + * and rvalue i.e. foo=HTONS(bar) is wrong. Likewise x=htons(x) should + * never be used where HTONS(x) will serve i.e. foo=htons(foo) is wrong. + * Failing to observe these rule will result in code that appears to work + * and probably does work, but generates gcc warnings on architectures + * where the macros are used to optimize away an unneeded conversion. */ #if BYTE_ORDER == BIG_ENDIAN && !defined(lint) #define ntohl(x) (x) @@ -73,10 +80,10 @@ __END_DECLS #define htonl(x) (x) #define htons(x) (x) -#define NTOHL(x) (x) -#define NTOHS(x) (x) -#define HTONL(x) (x) -#define HTONS(x) (x) +#define NTOHL(x) (void) (x) +#define NTOHS(x) (void) (x) +#define HTONL(x) (void) (x) +#define HTONS(x) (void) (x) #else |