diff options
Diffstat (limited to 'libcpp/lex.c')
-rw-r--r-- | libcpp/lex.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c index 7e2db64..5cc2224 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -2325,7 +2325,7 @@ _cpp_lex_direct (cpp_reader *pfile) else if (c == '/' && (CPP_OPTION (pfile, cplusplus_comments) || cpp_in_system_header (pfile))) { - /* Warn about comments only if pedantically GNUC89, and not + /* Warn about comments if pedantically GNUC89, and not in system headers. */ if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile) && ! buffer->warned_cplusplus_comments) @@ -2336,6 +2336,16 @@ _cpp_lex_direct (cpp_reader *pfile) "(this will be reported only once per input file)"); buffer->warned_cplusplus_comments = 1; } + /* Or if specifically desired via -Wc90-c99-compat. */ + else if (CPP_OPTION (pfile, cpp_warn_c90_c99_compat) + && ! buffer->warned_cplusplus_comments) + { + cpp_error (pfile, CPP_DL_WARNING, + "C++ style comments are are incompatible with C90"); + cpp_error (pfile, CPP_DL_WARNING, + "(this will be reported only once per input file)"); + buffer->warned_cplusplus_comments = 1; + } if (skip_line_comment (pfile) && CPP_OPTION (pfile, warn_comments)) cpp_warning (pfile, CPP_W_COMMENTS, "multi-line comment"); |