From 7aee864645f2ec7c418030977b7d7ab00908371d Mon Sep 17 00:00:00 2001 From: Edward Smith-Rowland <3dw4rd@verizon.net> Date: Wed, 9 Jul 2014 13:33:58 +0000 Subject: [PATCH] PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped libcpp/ 2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped by preprocessor * lex.c (lex_raw_string ()): Do not warn about invalid suffix if skipping. (lex_string ()): Ditto. gcc/testsuite/ 2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped g++.dg/cpp0x/pr58155.C: New. From-SVN: r212392 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/pr58155.C | 13 +++++++++++++ libcpp/ChangeLog | 7 +++++++ libcpp/lex.c | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr58155.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c02b10c1061f..9c42d59d936e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net> + + PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped + g++.dg/cpp0x/pr58155.C: New. + 2014-07-09 Dominique d'Humieres PR testsuite/61453 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr58155.C b/gcc/testsuite/g++.dg/cpp0x/pr58155.C new file mode 100644 index 000000000000..60b02ab657dc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr58155.C @@ -0,0 +1,13 @@ +// { dg-do compile { target c++11 } } + +#define BAZ "baz" + +#if 0 + +"bar"BAZ + +R"( + bar +)"BAZ + +#endif diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index e6af9f722e57..f22471b229e3 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,10 @@ +2014-07-09 Edward Smith-Rowland <3dw4rd@verizon.net> + + PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped + by preprocessor + * lex.c (lex_raw_string ()): Do not warn about invalid suffix + if skipping. (lex_string ()): Ditto. + 2014-06-04 Edward Smith-Rowland <3dw4rd@verizon.net> PR c++/61038 diff --git a/libcpp/lex.c b/libcpp/lex.c index b7836225332b..9130cbcee915 100644 --- a/libcpp/lex.c +++ b/libcpp/lex.c @@ -1646,7 +1646,7 @@ lex_raw_string (cpp_reader *pfile, cpp_token *token, const uchar *base, if (is_macro (pfile, cur)) { /* Raise a warning, but do not consume subsequent tokens. */ - if (CPP_OPTION (pfile, warn_literal_suffix)) + if (CPP_OPTION (pfile, warn_literal_suffix) && !pfile->state.skipping) cpp_warning_with_line (pfile, CPP_W_LITERAL_SUFFIX, token->src_loc, 0, "invalid suffix on literal; C++11 requires " @@ -1775,7 +1775,7 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base) if (is_macro (pfile, cur)) { /* Raise a warning, but do not consume subsequent tokens. */ - if (CPP_OPTION (pfile, warn_literal_suffix)) + if (CPP_OPTION (pfile, warn_literal_suffix) && !pfile->state.skipping) cpp_warning_with_line (pfile, CPP_W_LITERAL_SUFFIX, token->src_loc, 0, "invalid suffix on literal; C++11 requires " -- 2.39.2