aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2002-04-21 16:17:55 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-04-21 16:17:55 +0000
commit9ac3b1bec7b58c6ad4a76782b1116dfb5f4cd0c6 (patch)
tree249f1d8f5adab5ad3e3c0bdc851bb1799c3102f2 /gcc/cppmacro.c
parentd8b85ae5975987fbac892ed4350d860b3abef533 (diff)
downloadgcc-9ac3b1bec7b58c6ad4a76782b1116dfb5f4cd0c6.zip
gcc-9ac3b1bec7b58c6ad4a76782b1116dfb5f4cd0c6.tar.gz
gcc-9ac3b1bec7b58c6ad4a76782b1116dfb5f4cd0c6.tar.bz2
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
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c17
1 files changed, 11 insertions, 6 deletions
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;
}