summaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-28 05:55:22 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-28 05:55:22 +0000
commit63e1abcebc4798da780b5334174d64e302d61f32 (patch)
treee397904d152d2097125d59904f15ea71e0957eb9 /gcc/cpplex.c
parentc1a4fd9101cf73ccb1d30961a6a37ca2201b1bf4 (diff)
downloadgcc-63e1abcebc4798da780b5334174d64e302d61f32.tar.gz
* cpperror.c (_cpp_begin_message): Do the test for suppression
of warnings and pedantic warnings before the "is a warning an error" tests. * cppinit.c (cpp_handle_option): Remove surplus \n. * cpplex.c (ON_REST_ARG): Delete. (skip_block_comment): Initialise prevc. (parse_args): Improve error messages. (maybe_paste_with_next): Use CONTEXT_VARARGS rather than ON_REST_ARG. * cpplib.c (cpp_push_buffer): Fix grammar in message. * cppmain.c (main): Set callbacks for #ident and #pragma only if no_output option is false. (do_pragma_implementation): Only call the #pragma handler if it is set in the cpp_reader structure. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36655 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r--gcc/cpplex.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 4b2f84b03f8..426e82d7e1d 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -162,10 +162,6 @@ TOKEN_LEN (token)
#define IS_ARG_CONTEXT(c) ((c)->flags & CONTEXT_ARG)
#define CURRENT_CONTEXT(pfile) ((pfile)->contexts + (pfile)->cur_context)
-#define ON_REST_ARG(c) \
- (((c)->u.list->flags & VAR_ARGS) \
- && (c)->u.list->tokens[(c)->posn - 1].val.aux \
- == (unsigned int) ((c)->u.list->paramc - 1))
#define ASSIGN_FLAGS_AND_POS(d, s) \
do {(d)->flags = (s)->flags & (PREV_WHITE | BOL | PASTE_LEFT); \
@@ -573,7 +569,7 @@ skip_block_comment (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer = pfile->buffer;
- cppchar_t c = EOF, prevc;
+ cppchar_t c = EOF, prevc = EOF;
pfile->state.lexing_comment = 1;
while (buffer->cur != buffer->rlimit)
@@ -1837,6 +1833,7 @@ is_macro_disabled (pfile, expansion, token)
pfile->no_expand_level = context - pfile->contexts;
next = _cpp_get_token (pfile);
restore_macro_expansion (pfile, prev_nme);
+
if (next->type != CPP_OPEN_PAREN)
{
_cpp_push_token (pfile, next);
@@ -2001,7 +1998,8 @@ parse_args (pfile, hp, args)
}
else
{
- cpp_error (pfile, "not enough arguments for macro \"%s\"", hp->name);
+ cpp_error (pfile, "%u arguments is not enough for macro \"%s\"",
+ argc, hp->name);
return 1;
}
}
@@ -2009,7 +2007,8 @@ parse_args (pfile, hp, args)
else if (argc > macro->paramc
&& !(macro->paramc == 0 && argc == 1 && empty_argument (args, 0)))
{
- cpp_error (pfile, "too many arguments for macro \"%s\"", hp->name);
+ cpp_error (pfile, "%u arguments is too many for macro \"%s\"",
+ argc, hp->name);
return 1;
}
@@ -2331,8 +2330,8 @@ maybe_paste_with_next (pfile, token)
<whatever> came from a variable argument, because
the author probably intended the ## to trigger
the special extended semantics (see above). */
- if (token->type == CPP_COMMA && IS_ARG_CONTEXT (context)
- && ON_REST_ARG (context - 1))
+ if (token->type == CPP_COMMA
+ && (context->flags & CONTEXT_VARARGS))
/* no warning */;
else
cpp_warning (pfile,