summaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-27 07:24:53 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-27 07:24:53 +0000
commitd6af03689afcb6d54e5ce66a399f68753a2aea3e (patch)
tree7ffd19f1f5d3104b1545c9af4c64c746cda65cbc /gcc/cpplex.c
parentfc54b737e45b3feef050092c62be54cf1b81c5a7 (diff)
downloadgcc-d6af03689afcb6d54e5ce66a399f68753a2aea3e.tar.gz
* cpplex.c (_cpp_lex_token): Handle directives in macro
arguments. * cpplib.c (_cpp_handle_directive): Save and restore state if parsing macro args when entering a directive. * cppmacro.c (collect_args): No need to handle directives in macro arguments. (enter_macro_context, replace_args): Use the original macro definition in case it was redefined whilst collecting arguments. doc: * cpp.texi: Update. testsuite: * gcc.dg/cpp/undef1.c: Remove. * gcc.dg/cpp/directiv.c: Update. * gcc.dg/cpp/mac-dir-1.c, mac-dir-2.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50091 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r--gcc/cpplex.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index eea6a9e1c53..a5a20db73d1 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -828,7 +828,10 @@ _cpp_lex_token (pfile)
/* Is this a directive. If _cpp_handle_directive returns
false, it is an assembler #. */
if (result->type == CPP_HASH
- && !pfile->state.parsing_args
+ /* 6.10.3 p 11: Directives in a list of macro arguments
+ gives undefined behavior. This implementation
+ handles the directive as normal. */
+ && pfile->state.parsing_args != 1
&& _cpp_handle_directive (pfile, result->flags & PREV_WHITE))
continue;
if (pfile->cb.line_change && !pfile->state.skipping)