[PATCH] Fix up bswap_* types

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


> In that case I think I could in {w,}ctype.h before including
> <bits/endian.h> define say `__need_byteorder' and then tweak guards
> in all the bits/endian.h so that they look like
> 
> #if !defined _ENDIAN_H && !defined __need_byteorder
>  # error blah...
> #endif
> 
> And it also looks that I have to move following definitions:
> #define __LITTLE_ENDIAN 1234
> #define __BIG_ENDIAN    4321
> #define __PDP_ENDIAN    3412
> from string/endian.h to ctype/ctype.h, otherwise charset test
> when running check just blow up.
> 
> What do ya say?

Oh, yeah.  So I think what you actually want in ctype.h et al is:

	#define __need_byteorder
	#include <endian.h>

Then make <endian.h> just define __*_ENDIAN and include <bits/endian.h>
if included with __need_byteorder defined, and only do its other
declarations (and _ENDIAN_H) if included without __need_byteorder defined.


Thanks,
Roland



More information about the Libc-alpha mailing list