From f6bbde28c477c7c5cb4d6c4d3e561b2d429afccf Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 8 Dec 2000 03:00:26 +0000 Subject: safe-ctype.h: New file. include: * safe-ctype.h: New file. libiberty: * safe-ctype.c: New file. * Makefile.in (CFILES): Add safe-ctype.c. (REQUIRED_OFILES): Add safe-ctype.o. * argv.c: Define ISBLANK and use it, not isspace. * basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c, strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c) before calling TOLOWER(c)/TOUPPER(c). gcc: * Makefile.in (HOST_RTL): Add safe-ctype.o. (safe-ctype.o): New rule. * system.h: Include safe-ctype.h, not ctype.h. No need to wrap ctype macros. * cpphash.h: Zap IStable and related macros. Define is_* in terms of safe-ctype.h macros. * cppinit.c: Delete the IStable and all related code. * tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and is_space arrays. Delete initialize_char_syntax. Change all references to the above arrays to use macros instead. * tradcpp.h: Define is_idchar, is_idstart, is_space, and is_nvspace in terms of safe_ctype.h's macros. * tradcif.y: is_idchar, is_idstart are macros not arrays. * config/i370/i370.c, config/winnt/dirent.c, config/winnt/fixinc-nt.c, config/winnt/ld.c: Use uppercase ctype macros. If we included ctype.h, include safe-ctype.h instead. * fixinc/fixfixes.c: Use uppercase ctype macros. Don't test ISLOWER(c) before calling TOUPPER(c). * fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk. * fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h. No need to wrap ctype macros. Don't test ISUPPER(x) before calling TOLOWER(x). gcc/ch: * lex.c: Don't bother checking whether ISUPPER(c) before calling TOLOWER(c). Don't bother checking whether isascii(c) before testing ISSPACE(c); ISSPACE(c) includes '\n'. gcc/f: * Make-lang.in: Link f/fini with safe-ctype.o. * bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c). * com.c: Use TOUPPER, not ffesrc_toupper. * fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c). * intrin.c: Don't test IN_CTYPE_DOMAIN(c). * src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their initializing code; use TOUPPER and TOLOWER instead of ffesrc_toupper and ffesrc_tolower. * src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_. Don't define ffesrc_toupper or ffesrc_tolower. gcc/java: * jvgenmain.c: Use ISPRINT not isascii. From-SVN: r38124 --- gcc/cppinit.c | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'gcc/cppinit.c') diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 7e5d7f6..9bed926 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -125,9 +125,6 @@ enum { QUOTE = 0, BRACKET, SYSTEM, AFTER }; runtime. */ #if HAVE_DESIGNATED_INITIALIZERS -#define init_IStable() /* Nothing. */ -#define ISTABLE __extension__ const U_CHAR _cpp_IStable[UCHAR_MAX + 1] = { - #define init_trigraph_map() /* Nothing. */ #define TRIGRAPH_MAP \ __extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = { @@ -137,10 +134,6 @@ __extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = { #else -#define ISTABLE unsigned char _cpp_IStable[UCHAR_MAX + 1] = { 0 }; \ - static void init_IStable PARAMS ((void)) { \ - unsigned char *x = _cpp_IStable; - #define TRIGRAPH_MAP U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = { 0 }; \ static void init_trigraph_map PARAMS ((void)) { \ unsigned char *x = _cpp_trigraph_map; @@ -150,45 +143,13 @@ __extension__ const U_CHAR _cpp_trigraph_map[UCHAR_MAX + 1] = { #endif -#define A(x) s(x, ISidnum|ISidstart) -#define N(x) s(x, ISidnum|ISnumstart) -#define H(x) s(x, IShspace|ISspace) -#define V(x) s(x, ISvspace|ISspace) -#define S(x) s(x, ISspace) - -ISTABLE - A('_') - - A('a') A('b') A('c') A('d') A('e') A('f') A('g') A('h') A('i') - A('j') A('k') A('l') A('m') A('n') A('o') A('p') A('q') A('r') - A('s') A('t') A('u') A('v') A('w') A('x') A('y') A('z') - - A('A') A('B') A('C') A('D') A('E') A('F') A('G') A('H') A('I') - A('J') A('K') A('L') A('M') A('N') A('O') A('P') A('Q') A('R') - A('S') A('T') A('U') A('V') A('W') A('X') A('Y') A('Z') - - N('1') N('2') N('3') N('4') N('5') N('6') N('7') N('8') N('9') N('0') - - H(' ') H('\t') - - V('\n') V('\r') - - S('\0') S('\v') S('\f') -END - TRIGRAPH_MAP s('=', '#') s(')', ']') s('!', '|') s('(', '[') s('\'', '^') s('>', '}') s('/', '\\') s('<', '{') s('-', '~') END -#undef A -#undef N -#undef H -#undef V -#undef S #undef s -#undef ISTABLE #undef END #undef TRIGRAPH_MAP @@ -507,11 +468,9 @@ initialize () qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp); #endif - /* Set up the trigraph map and the IStable. These don't need to do - anything if we were compiled with a compiler that supports C99 - designated initializers. */ + /* Set up the trigraph map. This doesn't need to do anything if we were + compiled with a compiler that supports C99 designated initializers. */ init_trigraph_map (); - init_IStable (); initialized = 1; } -- cgit v1.1