This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [Patch] Fix MIPS build failure caused by -Werror=undef
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: "Maciej W. Rozycki" <macro at linux-mips dot org>
- Cc: Joseph Myers <joseph at codesourcery dot com>, <libc-alpha at sourceware dot org>
- Date: Tue, 17 Feb 2015 13:37:15 -0800
- Subject: Re: [Patch] Fix MIPS build failure caused by -Werror=undef
- Authentication-results: sourceware.org; auth=none
- References: <04dee4c5-a06d-447e-8174-ab39f52a4b48 at BAMAIL02 dot ba dot imgtec dot org> <alpine dot LFD dot 2 dot 11 dot 1502140537270 dot 11294 at eddie dot linux-mips dot org> <1424196067 dot 27855 dot 80 dot camel at ubuntu-sellcey> <alpine dot DEB dot 2 dot 10 dot 1502171808520 dot 19294 at digraph dot polyomino dot org dot uk> <alpine dot LFD dot 2 dot 11 dot 1502171929540 dot 1995 at eddie dot linux-mips dot org>
- Reply-to: <sellcey at imgtec dot com>
On Tue, 2015-02-17 at 19:58 +0000, Maciej W. Rozycki wrote:
> There's clearly nothing Linux specific there although one might ask which
> of the two of __MIPSEB vs __MIPSEB__ is the "traditional" macro we might
> want to keep. Or maybe _MIPSEB even. I'm not sure offhand and clearly
> current GCC defines all at a time.
>
> Also I wonder if sanity checks like:
>
> #if defined (__MIPSEB) && defined (__MIPSEL)
> # error "Both __MIPSEB and __MIPSEL, endianness configuration problem?"
> #elif defined (__MIPSEB)
> # define __BYTE_ORDER __BIG_ENDIAN
> #elif defined (__MIPSEL)
> # define __BYTE_ORDER __LITTLE_ENDIAN
> #elif
> # error "Neither __MIPSEB nor __MIPSEL, endianness configuration problem?"
> #endif
>
> would make sense here too, to catch issues early on in case someone does
> something silly with `-D' or `-U'.
>
> Maciej
I wonder if we should check here or if we should check in the shared
src/glibc/string/endian.h file. We could verify that after including a
system specific bits/endian.h, __BYTE_ORDER is defined to either
__BIG_ENDIAN or __LITTLE_ENDIAN.
Maybe change this check in src/glibc/string/endian.h to have a '#else
#error' clause. Is it ever legal to not define __BYTE_ORDER?
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define __LONG_LONG_PAIR(HI, LO) LO, HI
#elif __BYTE_ORDER == __BIG_ENDIAN
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
Steve Ellcey