This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] replace LIBGCC2_WORDS_BIG_ENDIAN with __WORDS_BIG_ENDIAN__
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Nathan Froyd <froydnj at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Oct 2010 23:03:19 +0200
- Subject: Re: [PATCH] replace LIBGCC2_WORDS_BIG_ENDIAN with __WORDS_BIG_ENDIAN__
- References: <20101012204838.GE24720@nightcrawler>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 12, 2010 at 04:48:39PM -0400, Nathan Froyd wrote:
> The patch below eliminates the need for LIBGCC2_WORDS_BIG_ENDIAN by
> having the compiler define __WORDS_BIG_ENDIAN__ and appropriate places
> use that instead. The motivating idea here is that the compiler should
> be queried for all target-specific knowledge when compiling target
> libraries. I plan to replace several other macros in a similar fashion.
Wouldn't it be better to define something like __BYTE_ORDER__
to 1234, 4321 or 3421 for little endian (WORDS+BYTES), big endian
(WORDS+BYTES) and PDP endian (see glibc's endian.h+bits/endian.h)?
That would avoid having to define also __BYTES_BIG_ENDIAN__ macro
and would be less misleading (seeing __WORDS_BIG_ENDIAN__ defined, albeit to
0, can be easily thought as that words are big endian rather than little
endian).
Jakub