https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00611.html
libcpp/
PR preprocessor/82506
* macro.c (cpp_quote_string): Escape raw LFs.
gcc/testsuite/
PR preprocessor/82506
* g++.dg/cpp/string-3.C: New.
From-SVN: r253605
+2017-10-10 Nathan Sidwell <nathan@acm.org>
+
+ PR preprocessor/82506
+ * g++.dg/cpp/string-3.C: New.
+
2017-10-10 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc.target/powerpc/fold-vec-splat-16.c: New
--- /dev/null
+// PR c++/82506
+// { dg-do preprocess { target c++11 } }
+
+#define STRINGIZE(A) #A
+
+BEGIN STRINGIZE(R"(
+)") END
+
+// { dg-final { scan-file string-3.ii "BEGIN \"R\\\"(\\n)\\\"\"\n END" } }
+2017-10-10 Nathan Sidwell <nathan@acm.org>
+
+ PR preprocessor/82506
+ * macro.c (cpp_quote_string): Escape raw LFs.
+
2017-09-15 Andrew Sutton <andrew.n.sutton@gmail.com>
Jakub Jelinek <jakub@redhat.com>
{
uchar c = *src++;
- if (c == '\\' || c == '"')
+ switch (c)
{
+ case '\n':
+ /* Naked LF can appear in raw string literals */
+ c = 'n';
+ /* FALLTHROUGH */
+
+ case '\\':
+ case '"':
*dest++ = '\\';
+ /* FALLTHROUGH */
+
+ default:
*dest++ = c;
}
- else
- *dest++ = c;
}
return dest;