aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorDoug Evans <devans@canuck.cygnus.com>1997-11-04 21:56:24 +0000
committerDoug Evans <devans@gcc.gnu.org>1997-11-04 21:56:24 +0000
commit645ebf3767cd0300bd13971385806f6cec547f05 (patch)
tree113549e740ff33b3151279ba291fc10c465c0515 /gcc/c-lex.c
parentf762058716bb17c563faad6a629fa92c86caea1a (diff)
downloadgcc-645ebf3767cd0300bd13971385806f6cec547f05.zip
gcc-645ebf3767cd0300bd13971385806f6cec547f05.tar.gz
gcc-645ebf3767cd0300bd13971385806f6cec547f05.tar.bz2
c-lex.c (MULTIBYTE_CHARS): #undef if cross compiling.
* c-lex.c (MULTIBYTE_CHARS): #undef if cross compiling. (yylex): Record wide strings using target endianness, not host. From-SVN: r16315
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index bee6ce7..1ec8f23 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -35,6 +35,13 @@ Boston, MA 02111-1307, USA. */
#include <ctype.h>
+/* MULTIBYTE_CHARS support only works for native compilers.
+ ??? Ideally what we want is to model widechar support after
+ the current floating point support. */
+#ifdef CROSS_COMPILE
+#undef MULTIBYTE_CHARS
+#endif
+
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
@@ -1999,15 +2006,9 @@ yylex ()
bzero (widep + (len * WCHAR_BYTES), WCHAR_BYTES);
#else
{
- union { long l; char c[sizeof (long)]; } u;
- int big_endian;
char *wp, *cp;
- /* Determine whether host is little or big endian. */
- u.l = 1;
- big_endian = u.c[sizeof (long) - 1];
- wp = widep + (big_endian ? WCHAR_BYTES - 1 : 0);
-
+ wp = widep + (BYTES_BIG_ENDIAN ? WCHAR_BYTES - 1 : 0);
bzero (widep, (p - token_buffer) * WCHAR_BYTES);
for (cp = token_buffer + 1; cp < p; cp++)
*wp = *cp, wp += WCHAR_BYTES;