Commit 9e1ac915 by Kaveh R. Ghazi Committed by Kaveh Ghazi

cppexp.c (parse_number): Use ISXDIGIT/hex_value.

	* cppexp.c (parse_number): Use ISXDIGIT/hex_value.
	* cpplex.c (hex_digit_value): Use hex_p/hex_value.
	* cppmain.c (general_init): Call hex_init.

From-SVN: r46912
parent 57870f8a
2001-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2001-11-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cppexp.c (parse_number): Use ISXDIGIT/hex_value.
* cpplex.c (hex_digit_value): Use hex_p/hex_value.
* cppmain.c (general_init): Call hex_init.
* config.gcc (i[34567]86-dg-dgux*): Don't set `out_file'. * config.gcc (i[34567]86-dg-dgux*): Don't set `out_file'.
* i386/dgux.h (ASM_FILE_START): Set to the meaningful portions * i386/dgux.h (ASM_FILE_START): Set to the meaningful portions
......
...@@ -129,14 +129,9 @@ parse_number (pfile, tok) ...@@ -129,14 +129,9 @@ parse_number (pfile, tok)
{ {
c = *p; c = *p;
if (ISDIGIT (c)) if (ISDIGIT (c)
digit = c - '0'; || (base == 16 && ISXDIGIT (c)))
/* We believe that in all live character sets, a-f are digit = hex_value (c);
consecutive, and so are A-F. */
else if (base == 16 && c >= 'a' && c <= 'f')
digit = c - 'a' + 10;
else if (base == 16 && c >= 'A' && c <= 'F')
digit = c - 'A' + 10;
else else
break; break;
......
...@@ -1601,13 +1601,10 @@ static unsigned int ...@@ -1601,13 +1601,10 @@ static unsigned int
hex_digit_value (c) hex_digit_value (c)
unsigned int c; unsigned int c;
{ {
if (c >= 'a' && c <= 'f') if (hex_p (c))
return c - 'a' + 10; return hex_value (c);
if (c >= 'A' && c <= 'F') else
return c - 'A' + 10; abort ();
if (c >= '0' && c <= '9')
return c - '0';
abort ();
} }
/* Parse a '\uNNNN' or '\UNNNNNNNN' sequence. Returns 1 to indicate /* Parse a '\uNNNN' or '\UNNNNNNNN' sequence. Returns 1 to indicate
......
...@@ -100,6 +100,7 @@ general_init (argv0) ...@@ -100,6 +100,7 @@ general_init (argv0)
xmalloc_set_program_name (progname); xmalloc_set_program_name (progname);
hex_init ();
gcc_init_libintl (); gcc_init_libintl ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment