summaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index a022581f84f..6ba7ec4780e 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -1015,6 +1015,9 @@ cpp_get_token (pfile)
return &pfile->avoid_paste;
}
+ if (pfile->state.in_directive && result->type == CPP_COMMENT)
+ continue;
+
if (result->type != CPP_NAME)
break;
@@ -1194,6 +1197,12 @@ parse_params (pfile, macro)
switch (token->type)
{
default:
+ /* Allow/ignore comments in parameter lists if we are
+ preserving comments in macro expansions. */
+ if (token->type == CPP_COMMENT
+ && ! CPP_OPTION (pfile, discard_comments_in_macro_exp))
+ continue;
+
cpp_error (pfile, "\"%s\" may not appear in macro parameter list",
cpp_token_as_text (pfile, token));
return 0;