aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-13 02:32:41 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-13 02:32:41 +0000
commitf9a0e96c1707a7f48f7d152901740444098c2628 (patch)
treef6656bb21e208ce3d9194a471d84e8b7a0fdac65 /gcc/cpphash.c
parentd55bb5be913e11b1ba639c124403ef0cd7e11517 (diff)
downloadgcc-f9a0e96c1707a7f48f7d152901740444098c2628.zip
gcc-f9a0e96c1707a7f48f7d152901740444098c2628.tar.gz
gcc-f9a0e96c1707a7f48f7d152901740444098c2628.tar.bz2
cppexp.c, [...]: Eradicate all traces of code dependent on traditional, lang_chill, or lang_fortran.
* 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. From-SVN: r35003
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index d18a415..749187f 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;