diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2000-12-08 03:00:26 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-12-08 03:00:26 +0000 |
commit | f6bbde28c477c7c5cb4d6c4d3e561b2d429afccf (patch) | |
tree | b03b87c4d027ec11c1f46fa69792393daa187ec4 /gcc/cpphash.h | |
parent | f3588f1aadd8d52686c3f18f7a07744a33bb4f6d (diff) | |
download | gcc-f6bbde28c477c7c5cb4d6c4d3e561b2d429afccf.tar.gz |
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
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r-- | gcc/cpphash.h | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h index 1f4f98554c4..e27290aca51 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -135,39 +135,30 @@ struct cpp_buffer unsigned char sysp; }; -/* Character classes. +/* Character classes. Based on the more primitive macros in safe-ctype.h. If the definition of `numchar' looks odd to you, please look up the definition of a pp-number in the C standard [section 6.4.8 of C99]. In the unlikely event that characters other than \r and \n enter the set is_vspace, the macro handle_newline() in cpplex.c must be updated. */ -#define ISidnum 0x01 /* a-zA-Z0-9_ */ -#define ISidstart 0x02 /* _a-zA-Z */ -#define ISnumstart 0x04 /* 0-9 */ -#define IShspace 0x08 /* ' ' \t */ -#define ISvspace 0x10 /* \r \n */ -#define ISspace 0x20 /* ' ' \t \r \n \f \v \0 */ - #define _dollar_ok(x) ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident)) -#define is_idchar(x) ((_cpp_IStable[x] & ISidnum) || _dollar_ok(x)) -#define is_idstart(x) ((_cpp_IStable[x] & ISidstart) || _dollar_ok(x)) -#define is_numchar(x) (_cpp_IStable[x] & ISidnum) -#define is_numstart(x) (_cpp_IStable[x] & ISnumstart) -#define is_hspace(x) (_cpp_IStable[x] & IShspace) -#define is_vspace(x) (_cpp_IStable[x] & ISvspace) -#define is_nvspace(x) ((_cpp_IStable[x] & (ISspace | ISvspace)) == ISspace) -#define is_space(x) (_cpp_IStable[x] & ISspace) +#define is_idchar(x) (ISIDNUM(x) || _dollar_ok(x)) +#define is_numchar(x) ISIDNUM(x) +#define is_idstart(x) (ISIDST(x) || _dollar_ok(x)) +#define is_numstart(x) ISDIGIT(x) +#define is_hspace(x) ISBLANK(x) +#define is_vspace(x) IS_VSPACE(x) +#define is_nvspace(x) IS_NVSPACE(x) +#define is_space(x) IS_SPACE_OR_NUL(x) -/* These tables are constant if they can be initialized at compile time, +/* This table is constant if it can be initialized at compile time, which is the case if cpp was compiled with GCC >=2.7, or another compiler that supports C99. */ #if HAVE_DESIGNATED_INITIALIZERS -extern const unsigned char _cpp_IStable[UCHAR_MAX + 1]; extern const unsigned char _cpp_trigraph_map[UCHAR_MAX + 1]; #else -extern unsigned char _cpp_IStable[UCHAR_MAX + 1]; extern unsigned char _cpp_trigraph_map[UCHAR_MAX + 1]; #endif |