PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped
authorEdward Smith-Rowland <3dw4rd@verizon.net>
Wed, 9 Jul 2014 13:33:58 +0000 (13:33 +0000)
committerEdward Smith-Rowland <emsr@gcc.gnu.org>
Wed, 9 Jul 2014 13:33:58 +0000 (13:33 +0000)
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
gcc/testsuite/g++.dg/cpp0x/pr58155.C [new file with mode: 0644]
libcpp/ChangeLog
libcpp/lex.c

index c02b10c..9c42d59 100644 (file)
@@ -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 <dominiq@lps.ens.fr>
 
        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 (file)
index 0000000..60b02ab
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-do compile { target c++11 } }
+
+#define BAZ "baz"
+
+#if 0
+
+"bar"BAZ
+
+R"(
+  bar
+)"BAZ
+
+#endif
index e6af9f7..f22471b 100644 (file)
@@ -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
index b783622..9130cbc 100644 (file)
@@ -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 "