diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-07-17 20:10:57 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-07-17 20:10:57 +0200 |
commit | 0c86a39db2888ddd17b21d0822b0907e4661d8b6 (patch) | |
tree | f900c8a020892d4af02d171ffe5ed7c3a00eb702 /libcpp | |
parent | 0ef03fe3d09f799b457eccf83247976e9a6da77d (diff) | |
download | gcc-0c86a39db2888ddd17b21d0822b0907e4661d8b6.zip gcc-0c86a39db2888ddd17b21d0822b0907e4661d8b6.tar.gz gcc-0c86a39db2888ddd17b21d0822b0907e4661d8b6.tar.bz2 |
lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN...
* lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN,
CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style
comments is reported only once per file and guard those calls on the
preceding cpp_error returning true.
* gcc.dg/cpp/pr61854-c90.c (foo): Expect a note, rather than error.
* gcc.dg/cpp/pr61854-c94.c (foo): Likewise.
* gcc.dg/cpp/pr61854-4.c (foo): Likewise.
* gcc.dg/cpp/pr61854-8.c: New test.
From-SVN: r262832
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/ChangeLog | 8 | ||||
-rw-r--r-- | libcpp/lex.c | 27 |
2 files changed, 22 insertions, 13 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7412800..3fef9c9 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,11 @@ +2018-07-17 Jason Franklin <j_fra@fastmail.us> + Jakub Jelinek <jakub@redhat.com> + + * lex.c (_cpp_lex_direct): Use CPP_DL_NOTE instead of CPP_DL_PEDWARN, + CPP_DL_WARNING or CPP_DL_ERROR for note that diagnostics for C++ style + comments is reported only once per file and guard those calls on the + preceding cpp_error returning true. + 2018-07-03 Nathan Sidwell <nathan@acm.org> Reorg line_map data structures for better packing. diff --git a/libcpp/lex.c b/libcpp/lex.c index 37c365a..a2592e0 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -2872,10 +2872,10 @@ _cpp_lex_direct (cpp_reader *pfile) && CPP_PEDANTIC (pfile) && ! buffer->warned_cplusplus_comments) { - cpp_error (pfile, CPP_DL_PEDWARN, - "C++ style comments are not allowed in ISO C90"); - cpp_error (pfile, CPP_DL_PEDWARN, - "(this will be reported only once per input file)"); + if (cpp_error (pfile, CPP_DL_PEDWARN, + "C++ style comments are not allowed in ISO C90")) + cpp_error (pfile, CPP_DL_NOTE, + "(this will be reported only once per input file)"); buffer->warned_cplusplus_comments = 1; } /* Or if specifically desired via -Wc90-c99-compat. */ @@ -2883,10 +2883,10 @@ _cpp_lex_direct (cpp_reader *pfile) && ! CPP_OPTION (pfile, cplusplus) && ! buffer->warned_cplusplus_comments) { - cpp_error (pfile, CPP_DL_WARNING, - "C++ style comments are incompatible with C90"); - cpp_error (pfile, CPP_DL_WARNING, - "(this will be reported only once per input file)"); + if (cpp_error (pfile, CPP_DL_WARNING, + "C++ style comments are incompatible with C90")) + cpp_error (pfile, CPP_DL_NOTE, + "(this will be reported only once per input file)"); buffer->warned_cplusplus_comments = 1; } /* In C89/C94, C++ style comments are forbidden. */ @@ -2906,11 +2906,12 @@ _cpp_lex_direct (cpp_reader *pfile) } else if (! buffer->warned_cplusplus_comments) { - cpp_error (pfile, CPP_DL_ERROR, - "C++ style comments are not allowed in ISO C90"); - cpp_error (pfile, CPP_DL_ERROR, - "(this will be reported only once per input " - "file)"); + if (cpp_error (pfile, CPP_DL_ERROR, + "C++ style comments are not allowed in " + "ISO C90")) + cpp_error (pfile, CPP_DL_NOTE, + "(this will be reported only once per input " + "file)"); buffer->warned_cplusplus_comments = 1; } } |