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
This commit is contained in:
parent
d8b85ae597
commit
9ac3b1bec7
@ -1,3 +1,8 @@
|
|||||||
|
2002-04-21 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* cppmacro.c (funlike_invocation_p): Don't step back
|
||||||
|
over CPP_EOF.
|
||||||
|
|
||||||
2002-04-21 David Edelsohn <edelsohn@gnu.org>
|
2002-04-21 David Edelsohn <edelsohn@gnu.org>
|
||||||
|
|
||||||
* config/rs6000/rs6000.c (output_profile_hook): Do not increment
|
* config/rs6000/rs6000.c (output_profile_hook): Do not increment
|
||||||
|
@ -632,12 +632,17 @@ funlike_invocation_p (pfile, node)
|
|||||||
return collect_args (pfile, node);
|
return collect_args (pfile, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Back up. We may have skipped padding, in which case backing up
|
/* CPP_EOF can be the end of macro arguments, or the end of the
|
||||||
more than one token when expanding macros is in general too
|
file. We mustn't back up over the latter. Ugh. */
|
||||||
difficult. We re-insert it in its own context. */
|
if (token->type != CPP_EOF || token == &pfile->eof)
|
||||||
_cpp_backup_tokens (pfile, 1);
|
{
|
||||||
if (padding)
|
/* Back up. We may have skipped padding, in which case backing
|
||||||
push_token_context (pfile, NULL, padding, 1);
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-04-21 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||||
|
|
||||||
|
* gcc.dg/cpp/endif.h, gcc.dg/cpp/endif.c: New tests.
|
||||||
|
|
||||||
2002-04-21 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
|
2002-04-21 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
|
||||||
|
|
||||||
* gcc.c-torture/execute/20000906-1.x: Delete.
|
* gcc.c-torture/execute/20000906-1.x: Delete.
|
||||||
|
14
gcc/testsuite/gcc.dg/cpp/endif.c
Normal file
14
gcc/testsuite/gcc.dg/cpp/endif.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/* Copyright (C) 2002 Free Software Foundation, Inc. */
|
||||||
|
|
||||||
|
/* { dg-do preprocess } */
|
||||||
|
|
||||||
|
/* Test case for PR preprocessor/6386 by Andreas Schwab. We'd back up
|
||||||
|
over the CPP_EOF token (indicating not a funlike macro invocation)
|
||||||
|
in the header file, which would then be passed through as a real
|
||||||
|
EOF, leading to an early exit (and therefore bogus complaint about
|
||||||
|
unterminated #if). */
|
||||||
|
|
||||||
|
#define S(x)
|
||||||
|
#if 1
|
||||||
|
#include "endif.h"
|
||||||
|
#endif
|
1
gcc/testsuite/gcc.dg/cpp/endif.h
Normal file
1
gcc/testsuite/gcc.dg/cpp/endif.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
S
|
Loading…
Reference in New Issue
Block a user