From 768169bd1d69862383de4016f7a41719e8be2992 Mon Sep 17 00:00:00 2001 From: ghazi Date: Sat, 10 Nov 2001 04:46:01 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46912 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/cppexp.c | 11 +++-------- gcc/cpplex.c | 11 ++++------- gcc/cppmain.c | 1 + 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index face7bd..86b64a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2001-11-09 Kaveh R. Ghazi + * 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'. * i386/dgux.h (ASM_FILE_START): Set to the meaningful portions diff --git a/gcc/cppexp.c b/gcc/cppexp.c index ac222ee..f7fe054 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -129,14 +129,9 @@ parse_number (pfile, tok) { c = *p; - if (ISDIGIT (c)) - digit = c - '0'; - /* We believe that in all live character sets, a-f are - 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; + if (ISDIGIT (c) + || (base == 16 && ISXDIGIT (c))) + digit = hex_value (c); else break; diff --git a/gcc/cpplex.c b/gcc/cpplex.c index a15fcca..f9af8b7 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -1601,13 +1601,10 @@ static unsigned int hex_digit_value (c) unsigned int c; { - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - if (c >= '0' && c <= '9') - return c - '0'; - abort (); + if (hex_p (c)) + return hex_value (c); + else + abort (); } /* Parse a '\uNNNN' or '\UNNNNNNNN' sequence. Returns 1 to indicate diff --git a/gcc/cppmain.c b/gcc/cppmain.c index 246c152..02dfdb7 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -100,6 +100,7 @@ general_init (argv0) xmalloc_set_program_name (progname); + hex_init (); gcc_init_libintl (); } -- 2.7.4