This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [PATCH] Fix up bswap_* types
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>, libc-ports <libc-ports at sourceware dot org>
- Date: Wed, 22 Aug 2012 16:14:36 -0700 (PDT)
- Subject: Re: [PATCH] Fix up bswap_* types
- References: <20120819160958.GB3156@redhat.com> <Pine.LNX.4.64.1208192243590.24239@digraph.polyomino.org.uk> <20120820143509.GG3156@redhat.com> <20120821210132.C13992C0D5@topped-with-meat.com> <20120822154645.GB16963@redhat.com> <20120822164747.90AD42C0F4@topped-with-meat.com> <20120822200555.GE16963@redhat.com> <20120822201224.5E0B22C0F8@topped-with-meat.com> <20120822230443.GG16963@redhat.com>
> 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