summaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-28 20:27:14 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-28 20:27:14 +0000
commit9a26b86fda84a56f2b05134b88723118da7a2cc9 (patch)
tree82a8c358372ac4c99b35ac4621f03bce02edd5b1 /gcc/cpplib.c
parentc4e91fc72c5e35cd6ade4ba5f8e1f4b1f7f782c1 (diff)
downloadgcc-9a26b86fda84a56f2b05134b88723118da7a2cc9.tar.gz
* cpplib.c (_cpp_handle_directive): Move #define-specific
code to the #define handler... (do_define): ...here. (lex_macro_node): No longer a need to check for comments here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55077 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index f2d33a89e48..fe6816cabde 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -443,16 +443,7 @@ _cpp_handle_directive (pfile, indented)
prepare_directive_trad (pfile);
if (dir)
- {
- /* If we are processing a `#define' directive and we have been
- requested to expand comments into macros, then re-enable
- saving of comments. */
- if (dir == &dtable[T_DEFINE])
- pfile->state.save_comments =
- ! CPP_OPTION (pfile, discard_comments_in_macro_exp);
-
- (*pfile->directive->handler) (pfile);
- }
+ (*pfile->directive->handler) (pfile);
else if (skip == 0)
_cpp_backup_tokens (pfile, 1);
@@ -502,16 +493,7 @@ lex_macro_node (pfile)
In C++, it may not be any of the "named operators" either,
per C++98 [lex.digraph], [lex.key].
Finally, the identifier may not have been poisoned. (In that case
- the lexer has issued the error message for us.)
-
- Note that if we're copying comments into macro expansions, we
- could encounter comment tokens here, so eat them all up first. */
-
- if (! CPP_OPTION (pfile, discard_comments_in_macro_exp))
- {
- while (token->type == CPP_COMMENT)
- token = _cpp_lex_token (pfile);
- }
+ the lexer has issued the error message for us.) */
if (token->type == CPP_NAME)
{
@@ -545,6 +527,11 @@ do_define (pfile)
if (node)
{
+ /* If we have been requested to expand comments into macros,
+ then re-enable saving of comments. */
+ pfile->state.save_comments =
+ ! CPP_OPTION (pfile, discard_comments_in_macro_exp);
+
if (_cpp_create_definition (pfile, node))
if (pfile->cb.define)
(*pfile->cb.define) (pfile, pfile->directive_line, node);