diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-13 02:32:41 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-07-13 02:32:41 +0000 |
commit | 241e762ee7945bc224c331bfe68ef2de97397350 (patch) | |
tree | f6656bb21e208ce3d9194a471d84e8b7a0fdac65 /gcc/cpphash.c | |
parent | c4b2e2d7cf9b748e87d521f4633e1f2263decfbc (diff) | |
download | gcc-241e762ee7945bc224c331bfe68ef2de97397350.tar.gz |
* cppexp.c, cpphash.c, cpphash.h, cppinit.c, cpplex.c,
cpplib.c, cpplib.h: Eradicate all traces of code dependent on
traditional, lang_chill, or lang_fortran.
* cppfiles.c: #undef strcmp to suppress warning about macros
used without arguments.
(_cpp_execute_include): Use f, not fname, in "No include path"
error.
(_cpp_pop_file_buffer): New function.
* cpplib.c: Don't include <sys/mman.h>.
(cpp_push_buffer): Set line_base and lineno in new buffer.
(cpp_pop_buffer): Use _cpp_pop_file_buffer.
* cpplex.c: Move all prototypes and structure declarations to the
top of the file. Properly parenthesise some macro arguments.
(cpp_scan_line): New function.
(special_symbol [case T_INCLUDE_DEPTH]): Use pfile->include_depth,
don't need to walk up the stack counting.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35003 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r-- | gcc/cpphash.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c index d18a4158395..749187fa90e 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -502,34 +502,33 @@ save_expansion (pfile, first, first_param, info) ntokens = len = 0; for (token = first; token->type != CPP_EOF; token++) { - const char *msg; - if (token->type == CPP_PASTE) { - /* Token-paste ##, but is a normal token if traditional. */ - if (! CPP_TRADITIONAL (pfile)) + /* Token-paste ##, can appear in both object-like and + function-like macros, but not at the ends. Constraint + 6.10.3.3.1 */ + if (token == first || token[1].type == CPP_EOF) { - msg = "\"##\" cannot appear at either end of a macro expansion"; - /* Constraint 6.10.3.3.1 */ - if (token == first || token[1].type == CPP_EOF) - goto error; - continue; + cpp_error_with_line (pfile, token->line, token->col, + "'##' cannot appear at either end of a macro expansion"); + return 0; } + continue; } else if (token->type == CPP_HASH) { - /* Stringifying #, but is a normal character if traditional, - or in object-like macros. Constraint 6.10.3.2.1. */ - if (info->paramc >= 0 && ! CPP_TRADITIONAL (pfile)) + /* Stringifying #, but a normal character in object-like + macros. Must come before a parameter name. Constraint + 6.10.3.2.1. */ + if (info->paramc >= 0) { if (token[1].type == CPP_NAME && find_param (first_param, token + 1)) continue; if (! CPP_OPTION (pfile, lang_asm)) { - msg = "'#' is not followed by a macro parameter"; - error: - cpp_error_with_line (pfile, token->line, token->col, msg); + cpp_error_with_line (pfile, token->line, token->col, + "'#' is not followed by a macro parameter"); return 0; } } @@ -583,7 +582,7 @@ save_expansion (pfile, first, first_param, info) dest->val.aux = param_no - 1; dest->type = CPP_MACRO_ARG; - if (token[-1].type == CPP_HASH && ! CPP_TRADITIONAL (pfile)) + if (token[-1].type == CPP_HASH) dest->flags = token[-1].flags | STRINGIFY_ARG; else dest->flags = token->flags; /* Particularly PREV_WHITE. */ @@ -591,17 +590,12 @@ save_expansion (pfile, first, first_param, info) continue; case CPP_PASTE: - if (! CPP_TRADITIONAL (pfile)) - { - dest[-1].flags |= PASTE_LEFT; - continue; - } - break; + dest[-1].flags |= PASTE_LEFT; + continue; case CPP_HASH: /* Stringifying #. Constraint 6.10.3.2.1 */ - if (list->paramc >= 0 && ! CPP_TRADITIONAL (pfile) - && token[1].type == CPP_NAME + if (list->paramc >= 0 && token[1].type == CPP_NAME && find_param (first_param, token + 1)) continue; break; |