From 9ac3b1bec7b58c6ad4a76782b1116dfb5f4cd0c6 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 21 Apr 2002 16:17:55 +0000 Subject: cppmacro.c (funlike_invocation_p): Don't step back over CPP_EOF. * cppmacro.c (funlike_invocation_p): Don't step back over CPP_EOF. testsuite: * gcc.dg/cpp/endif.h, gcc.dg/cpp/endif.c: New tests. From-SVN: r52586 --- gcc/cppmacro.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gcc/cppmacro.c') diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index 2070851..d39bd45 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -632,12 +632,17 @@ funlike_invocation_p (pfile, node) return collect_args (pfile, node); } - /* Back up. We may have skipped padding, in which case backing up - more than one token when expanding macros is in general too - difficult. We re-insert it in its own context. */ - _cpp_backup_tokens (pfile, 1); - if (padding) - push_token_context (pfile, NULL, padding, 1); + /* CPP_EOF can be the end of macro arguments, or the end of the + file. We mustn't back up over the latter. Ugh. */ + if (token->type != CPP_EOF || token == &pfile->eof) + { + /* Back up. We may have skipped padding, in which case backing + up more than one token when expanding macros is in general + too difficult. We re-insert it in its own context. */ + _cpp_backup_tokens (pfile, 1); + if (padding) + push_token_context (pfile, NULL, padding, 1); + } return NULL; } -- cgit v1.1