[PATCH] Fix up bswap_* types

Roland McGrath roland@hack.frob.com
Wed Aug 22 23:46:00 GMT 2012


> Personally I find the __need_* scheme pretty fragile, and it's also been 
> reported as causing problems for such things as attempts at pre-parsed 
> headers in GCC - it's generally nicer if a header does something 
> well-defined that doesn't depend on whether such a macro is defined before 
> including it.

It's true.  I was suggesting something that follows the prevailing scheme
for such cases, but that doesn't mean it's the ideal scheme.

> Thus, whenever you are tempted to give a header a special __need_* 
> interface, I'd rather split out the relevant bits into a new internal 
> (bits/*) header and include that header in both places.

Yes, we could instead move __*_ENDIAN into another file.  The cleanest
arrangement would be:

* bits/endian.h becomes a generic header that defines __*_ENDIAN and does
  #include <bits/byteorder.h>.  Only this file would need complex
  guards to allow inclusion via <endian.h> or <ctype.h> or <wctype.h>.
* sysdeps bits/endian.h files all renamed to bits/byteorder.h and have
  a guard for _BITS_BYTEORDER_H.


Thanks,
Roland



More information about the Libc-alpha mailing list