diff options
author | brolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-07 14:15:29 +0000 |
---|---|---|
committer | brolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-07 14:15:29 +0000 |
commit | e2fba1154d5f33e785a72cd78bd9958c917f03f8 (patch) | |
tree | 88adc2af69a7da636a68ab4d8b14fa33e27d1ed3 /gcc/cpplib.c | |
parent | bbe5b5e390cbfc384dfeba093af5d0054f7cf3f0 (diff) | |
download | gcc-e2fba1154d5f33e785a72cd78bd9958c917f03f8.tar.gz |
1998-12-07 Zack Weinberg <zack@rabi.phys.columbia.edu>
* cpplib.c (initialize_char_syntax): Use ISALPHA and ISALNUM
so it'll work on non-ASCII platforms. Always consider $ an
identifier character. Take no arguments.
(cpp_reader_init): Call initialize_char_syntax with no
arguments.
(cpp_start_read): Don't call initialize_char_syntax again.
Clear is_idchar['$'] and is_idstart['$'] if not
opts->dollars_in_ident.
* cpplib.h (struct cpp_reader): Replace void *data element by
cpp_options *opts. Rearrange elements to make gdb printout
less annoying (put buffer stack at end).
(CPP_OPTIONS): Get rid of now-unnecessary cast.
* cppmain.c: s/data/opts/ when initializing cpp_reader
structure.
* c-decl.c: Likewise.
* objc/objc-act.c: Likewise.
* fix-header.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24154 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r-- | gcc/cpplib.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c index dbdf2f45c08..8d408d0048c 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -169,7 +169,7 @@ static char *my_strerror PROTO ((int)); static void make_assertion PROTO ((cpp_reader *, char *, U_CHAR *)); static void path_include PROTO ((cpp_reader *, char *)); static void initialize_builtins PROTO ((cpp_reader *)); -static void initialize_char_syntax PROTO ((struct cpp_options *)); +static void initialize_char_syntax PROTO ((void)); #if 0 static void trigraph_pcp (); #endif @@ -339,11 +339,9 @@ U_CHAR is_hor_space[256] = { 0 }; /* table to tell if c is horizontal or vertical space. */ U_CHAR is_space[256] = { 0 }; -/* Initialize syntactic classifications of characters. */ - +/* Initialize syntactic classifications of characters. */ static void -initialize_char_syntax (opts) - struct cpp_options *opts; +initialize_char_syntax () { register int i; @@ -352,19 +350,20 @@ initialize_char_syntax (opts) * faster than saying (is_alpha (c) || c == '_'), etc. * Set up these things before calling any routines tthat * refer to them. + * XXX We should setlocale(LC_CTYPE, "C") here for safety. */ - for (i = 'a'; i <= 'z'; i++) { - is_idchar[i - 'a' + 'A'] = 1; - is_idchar[i] = 1; - is_idstart[i - 'a' + 'A'] = 1; - is_idstart[i] = 1; - } - for (i = '0'; i <= '9'; i++) - is_idchar[i] = 1; - is_idchar['_'] = 1; + for (i = 0; i < 256; i++) + { + is_idchar[i] = ISALNUM (i); + is_idstart[i] = ISALPHA (i); + } + + is_idchar['_'] = 1; is_idstart['_'] = 1; - is_idchar['$'] = opts->dollars_in_ident; - is_idstart['$'] = opts->dollars_in_ident; + + /* These will be reset later if -$ is in effect. */ + is_idchar['$'] = 1; + is_idstart['$'] = 1; /* horizontal space table */ is_hor_space[' '] = 1; @@ -595,9 +594,8 @@ cpp_options_init (opts) opts->in_fname = NULL; opts->out_fname = NULL; - /* Initialize is_idchar to allow $. */ opts->dollars_in_ident = 1; - initialize_char_syntax (opts); + initialize_char_syntax (); opts->no_line_commands = 0; opts->no_trigraphs = 1; @@ -4837,6 +4835,11 @@ cpp_start_read (pfile, fname) variable specifies other defaults. */ struct default_include *include_defaults = include_defaults_array; + /* Now that we know dollars_in_ident for real, + reset is_idchar/is_idstart. */ + is_idchar['$'] = opts->dollars_in_ident; + is_idstart['$'] = opts->dollars_in_ident; + /* Add dirs from CPATH after dirs from -I. */ /* There seems to be confusion about what CPATH should do, so for the moment it is not documented. */ @@ -4847,9 +4850,6 @@ cpp_start_read (pfile, fname) if (p != 0 && ! opts->no_standard_includes) path_include (pfile, p); - /* Now that dollars_in_ident is known, initialize is_idchar. */ - initialize_char_syntax (opts); - /* Do partial setup of input buffer for the sake of generating early #line directives (when -g is in effect). */ fp = cpp_push_buffer (pfile, NULL, 0); |