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: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Roland McGrath <roland at hack dot frob 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 23:32:40 +0000
- 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>
On Thu, 23 Aug 2012, Marek Polacek wrote:
> On Wed, Aug 22, 2012 at 01:12:24PM -0700, Roland McGrath wrote:
> > They are wrong to include <endian.h>, which declares public symbols.
> > They should use only <bits/endian.h> instead. This means all the various
> > bits/endian.h files need their #ifndef _ENDIAN_H sanity checks adjusted.
>
> 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
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.
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.
--
Joseph S. Myers
joseph@codesourcery.com