Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Remove __OPTIMIZE__ requirement to expand the byte s...



details:   https://anonhg.NetBSD.org/src/rev/f63d32f071ad
branches:  trunk
changeset: 336711:f63d32f071ad
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 12 15:28:16 2015 +0000

description:
Remove __OPTIMIZE__ requirement to expand the byte swap macros. Back in
2006 this change was reverted because some of the arch-specific libraries
were broken, and this was hiding this fact. Now, we have code like

        static const struct in_addr inmask32 = {.s_addr = INADDR_BROADCAST};

which breaks gcc when compiling without optimization since it does not see
that the expression is constant.

diffstat:

 sys/sys/bswap.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 57111d5a17c1 -r f63d32f071ad sys/sys/bswap.h
--- a/sys/sys/bswap.h   Thu Mar 12 15:09:04 2015 +0000
+++ b/sys/sys/bswap.h   Thu Mar 12 15:28:16 2015 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: bswap.h,v 1.18 2015/02/26 15:01:53 joerg Exp $      */
+/*      $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $      */
 
 /* Written by Manuel Bouyer. Public domain */
 
@@ -22,7 +22,7 @@
 uint64_t bswap64(uint64_t) __constfunc;
 __END_DECLS
 
-#if defined(__GNUC__) && defined(__OPTIMIZE__) && !defined(__lint__)
+#if defined(__GNUC__) && !defined(__lint__)
 
 /* machine/byte_swap.h might have defined inline versions */
 #ifndef __BYTE_SWAP_U64_VARIABLE
@@ -72,7 +72,7 @@
        __CAST(uint16_t, __builtin_constant_p((x)) ? \
         __byte_swap_u16_constant(x) : __BYTE_SWAP_U16_VARIABLE(x))
 
-#endif /* __GNUC__ && __OPTIMIZE__ */
+#endif /* __GNUC__ && !__lint__ */
 #endif /* !_LOCORE */
 
 #endif /* !_SYS_BSWAP_H_ */



Home | Main Index | Thread Index | Old Index