aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-07-21 04:28:03 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-07-21 04:28:03 +0200
commit8cf887352b795b59e9666513f8c8ca0c0908a38c (patch)
tree6ed6396fa7b067df8a3ff310a4f33ede51228e59 /gcc/testsuite/c-c++-common
parenta1d6f2a23f5d336b13d7d1a2a5306ec785cdbd74 (diff)
downloadgcc-8cf887352b795b59e9666513f8c8ca0c0908a38c.zip
gcc-8cf887352b795b59e9666513f8c8ca0c0908a38c.tar.gz
gcc-8cf887352b795b59e9666513f8c8ca0c0908a38c.tar.bz2
re PR preprocessor/57620 (Phantom terminator confuses raw string literal parsing.)
PR preprocessor/57620 * lex.c (lex_raw_string): Undo phase1 and phase2 transformations between R" and final " rather than only in between R"del( and )del". * c-c++-common/raw-string-2.c (s12, u12, U12, L12): Remove. (main): Don't test {s,u,U,L}12. * c-c++-common/raw-string-13.c: New test. * c-c++-common/raw-string-14.c: New test. * c-c++-common/raw-string-15.c: New test. * c-c++-common/raw-string-16.c: New test. From-SVN: r201091
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-13.c272
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-14.c39
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-15.c272
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-16.c33
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-2.c12
5 files changed, 616 insertions, 12 deletions
diff --git a/gcc/testsuite/c-c++-common/raw-string-13.c b/gcc/testsuite/c-c++-common/raw-string-13.c
new file mode 100644
index 0000000..1b37405
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-13.c
@@ -0,0 +1,272 @@
+// PR preprocessor/57620
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
+// { dg-options "-std=c++11" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#define R
+#define u
+#define uR
+#define U
+#define UR
+#define u8
+#define u8R
+#define L
+#define LR
+
+const char s00[] = R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char s01[] = R"a(
+)\
+a"
+)a";
+const char s02[] = R"a(
+)a\
+"
+)a";
+const char s03[] = R"ab(
+)a\
+b"
+)ab";
+const char s04[] = R"a??/(x)a??/";
+const char s05[] = R"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char s06[] = R"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char s07[] = R"abc(??)\
+abc";)abc";
+const char s08[] = R"def(de)\
+def";)def";
+const char s09[] = R"a(??)\
+a"
+)a";
+const char s10[] = R"a(??)a\
+"
+)a";
+const char s11[] = R"ab(??)a\
+b"
+)ab";
+const char s12[] = R"a#(a#)a??=)a#";
+const char s13[] = R"a#(??)a??=??)a#";
+const char s14[] = R"??/(x)??/
+";)??/";
+const char s15[] = R"??/(??)??/
+";)??/";
+const char s16[] = R"??(??)??";
+const char s17[] = R"?(?)??)?";
+const char s18[] = R"??(??)??)??)??";
+
+const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char16_t u01[] = uR"a(
+)\
+a"
+)a";
+const char16_t u02[] = uR"a(
+)a\
+"
+)a";
+const char16_t u03[] = uR"ab(
+)a\
+b"
+)ab";
+const char16_t u04[] = uR"a??/(x)a??/";
+const char16_t u05[] = uR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char16_t u06[] = uR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char16_t u07[] = uR"abc(??)\
+abc";)abc";
+const char16_t u08[] = uR"def(de)\
+def";)def";
+const char16_t u09[] = uR"a(??)\
+a"
+)a";
+const char16_t u10[] = uR"a(??)a\
+"
+)a";
+const char16_t u11[] = uR"ab(??)a\
+b"
+)ab";
+const char16_t u12[] = uR"a#(a#)a??=)a#";
+const char16_t u13[] = uR"a#(??)a??=??)a#";
+const char16_t u14[] = uR"??/(x)??/
+";)??/";
+const char16_t u15[] = uR"??/(??)??/
+";)??/";
+const char16_t u16[] = uR"??(??)??";
+const char16_t u17[] = uR"?(?)??)?";
+const char16_t u18[] = uR"??(??)??)??)??";
+
+const char32_t U00[] = UR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char32_t U01[] = UR"a(
+)\
+a"
+)a";
+const char32_t U02[] = UR"a(
+)a\
+"
+)a";
+const char32_t U03[] = UR"ab(
+)a\
+b"
+)ab";
+const char32_t U04[] = UR"a??/(x)a??/";
+const char32_t U05[] = UR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char32_t U06[] = UR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char32_t U07[] = UR"abc(??)\
+abc";)abc";
+const char32_t U08[] = UR"def(de)\
+def";)def";
+const char32_t U09[] = UR"a(??)\
+a"
+)a";
+const char32_t U10[] = UR"a(??)a\
+"
+)a";
+const char32_t U11[] = UR"ab(??)a\
+b"
+)ab";
+const char32_t U12[] = UR"a#(a#)a??=)a#";
+const char32_t U13[] = UR"a#(??)a??=??)a#";
+const char32_t U14[] = UR"??/(x)??/
+";)??/";
+const char32_t U15[] = UR"??/(??)??/
+";)??/";
+const char32_t U16[] = UR"??(??)??";
+const char32_t U17[] = UR"?(?)??)?";
+const char32_t U18[] = UR"??(??)??)??)??";
+
+const wchar_t L00[] = LR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const wchar_t L01[] = LR"a(
+)\
+a"
+)a";
+const wchar_t L02[] = LR"a(
+)a\
+"
+)a";
+const wchar_t L03[] = LR"ab(
+)a\
+b"
+)ab";
+const wchar_t L04[] = LR"a??/(x)a??/";
+const wchar_t L05[] = LR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const wchar_t L06[] = LR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const wchar_t L07[] = LR"abc(??)\
+abc";)abc";
+const wchar_t L08[] = LR"def(de)\
+def";)def";
+const wchar_t L09[] = LR"a(??)\
+a"
+)a";
+const wchar_t L10[] = LR"a(??)a\
+"
+)a";
+const wchar_t L11[] = LR"ab(??)a\
+b"
+)ab";
+const wchar_t L12[] = LR"a#(a#)a??=)a#";
+const wchar_t L13[] = LR"a#(??)a??=??)a#";
+const wchar_t L14[] = LR"??/(x)??/
+";)??/";
+const wchar_t L15[] = LR"??/(??)??/
+";)??/";
+const wchar_t L16[] = LR"??(??)??";
+const wchar_t L17[] = LR"?(?)??)?";
+const wchar_t L18[] = LR"??(??)??)??)??";
+
+int
+main (void)
+{
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+ TEST (s00, "??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (s01, "\n)\\\na\"\n");
+ TEST (s02, "\n)a\\\n\"\n");
+ TEST (s03, "\n)a\\\nb\"\n");
+ TEST (s04, "x");
+ TEST (s05, "abc");
+ TEST (s06, "abc");
+ TEST (s07, "??"")\\\nabc\";");
+ TEST (s08, "de)\\\ndef\";");
+ TEST (s09, "??"")\\\na\"\n");
+ TEST (s10, "??"")a\\\n\"\n");
+ TEST (s11, "??"")a\\\nb\"\n");
+ TEST (s12, "a#)a??""=");
+ TEST (s13, "??"")a??""=??");
+ TEST (s14, "x)??""/\n\";");
+ TEST (s15, "??"")??""/\n\";");
+ TEST (s16, "??");
+ TEST (s17, "?)??");
+ TEST (s18, "??"")??"")??");
+ TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (u01, u"\n)\\\na\"\n");
+ TEST (u02, u"\n)a\\\n\"\n");
+ TEST (u03, u"\n)a\\\nb\"\n");
+ TEST (u04, u"x");
+ TEST (u05, u"abc");
+ TEST (u06, u"abc");
+ TEST (u07, u"??"")\\\nabc\";");
+ TEST (u08, u"de)\\\ndef\";");
+ TEST (u09, u"??"")\\\na\"\n");
+ TEST (u10, u"??"")a\\\n\"\n");
+ TEST (u11, u"??"")a\\\nb\"\n");
+ TEST (u12, u"a#)a??""=");
+ TEST (u13, u"??"")a??""=??");
+ TEST (u14, u"x)??""/\n\";");
+ TEST (u15, u"??"")??""/\n\";");
+ TEST (u16, u"??");
+ TEST (u17, u"?)??");
+ TEST (u18, u"??"")??"")??");
+ TEST (U00, U"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (U01, U"\n)\\\na\"\n");
+ TEST (U02, U"\n)a\\\n\"\n");
+ TEST (U03, U"\n)a\\\nb\"\n");
+ TEST (U04, U"x");
+ TEST (U05, U"abc");
+ TEST (U06, U"abc");
+ TEST (U07, U"??"")\\\nabc\";");
+ TEST (U08, U"de)\\\ndef\";");
+ TEST (U09, U"??"")\\\na\"\n");
+ TEST (U10, U"??"")a\\\n\"\n");
+ TEST (U11, U"??"")a\\\nb\"\n");
+ TEST (U12, U"a#)a??""=");
+ TEST (U13, U"??"")a??""=??");
+ TEST (U14, U"x)??""/\n\";");
+ TEST (U15, U"??"")??""/\n\";");
+ TEST (U16, U"??");
+ TEST (U17, U"?)??");
+ TEST (U18, U"??"")??"")??");
+ TEST (L00, L"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (L01, L"\n)\\\na\"\n");
+ TEST (L02, L"\n)a\\\n\"\n");
+ TEST (L03, L"\n)a\\\nb\"\n");
+ TEST (L04, L"x");
+ TEST (L05, L"abc");
+ TEST (L06, L"abc");
+ TEST (L07, L"??"")\\\nabc\";");
+ TEST (L08, L"de)\\\ndef\";");
+ TEST (L09, L"??"")\\\na\"\n");
+ TEST (L10, L"??"")a\\\n\"\n");
+ TEST (L11, L"??"")a\\\nb\"\n");
+ TEST (L12, L"a#)a??""=");
+ TEST (L13, L"??"")a??""=??");
+ TEST (L14, L"x)??""/\n\";");
+ TEST (L15, L"??"")??""/\n\";");
+ TEST (L16, L"??");
+ TEST (L17, L"?)??");
+ TEST (L18, L"??"")??"")??");
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-14.c b/gcc/testsuite/c-c++-common/raw-string-14.c
new file mode 100644
index 0000000..2eeb725
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-14.c
@@ -0,0 +1,39 @@
+// PR preprocessor/57620
+// { dg-do compile }
+// { dg-options "-std=gnu99 -trigraphs" { target c } }
+// { dg-options "-std=c++11" { target c++ } }
+
+const void *s0 = R"abc\
+def()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 6 }
+ // { dg-error "stray" "stray" { target *-*-* } 6 }
+const void *s1 = R"??/
+()??/";
+ // { dg-error "invalid new-line" "invalid" { target *-*-* } 10 }
+ // { dg-error "stray" "stray" { target *-*-* } 10 }
+ // { dg-warning "missing terminating" "missing" { target *-*-* } 10 }
+ // { dg-error "missing terminating" "missing" { target *-*-* } 10 }
+const void *s2 = R"abcdefghijklmn??/(a)abcdefghijklmn???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 16 }
+ // { dg-error "stray" "stray" { target *-*-* } 16 }
+ // { dg-error "expected" "expected" { target *-*-* } 16 }
+const void *s3 = R"abcdefghijklmno??/(a)abcdefghijklmno???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 20 }
+ // { dg-error "stray" "stray" { target *-*-* } 20 }
+const void *s4 = R"abcdefghijklmnop??=(a)abcdefghijklmnop??=";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 23 }
+ // { dg-error "stray" "stray" { target *-*-* } 23 }
+const void *s5 = R"abc\
+()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 26 }
+ // { dg-error "stray" "stray" { target *-*-* } 26 }
+const void *s6 = R"\
+()";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 30 }
+ // { dg-error "stray" "stray" { target *-*-* } 30 }
+const void *s7 = R"\
+a()a";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 34 }
+ // { dg-error "stray" "stray" { target *-*-* } 34 }
+
+int main () {}
diff --git a/gcc/testsuite/c-c++-common/raw-string-15.c b/gcc/testsuite/c-c++-common/raw-string-15.c
new file mode 100644
index 0000000..9dfdaab
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-15.c
@@ -0,0 +1,272 @@
+// PR preprocessor/57620
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -Wtrigraphs" { target c } }
+// { dg-options "-std=gnu++11 -Wtrigraphs" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#define R
+#define u
+#define uR
+#define U
+#define UR
+#define u8
+#define u8R
+#define L
+#define LR
+
+const char s00[] = R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char s01[] = R"a(
+)\
+a"
+)a";
+const char s02[] = R"a(
+)a\
+"
+)a";
+const char s03[] = R"ab(
+)a\
+b"
+)ab";
+const char s04[] = R"a??/(x)a??/";
+const char s05[] = R"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char s06[] = R"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char s07[] = R"abc(??)\
+abc";)abc";
+const char s08[] = R"def(de)\
+def";)def";
+const char s09[] = R"a(??)\
+a"
+)a";
+const char s10[] = R"a(??)a\
+"
+)a";
+const char s11[] = R"ab(??)a\
+b"
+)ab";
+const char s12[] = R"a#(a#)a??=)a#";
+const char s13[] = R"a#(??)a??=??)a#";
+const char s14[] = R"??/(x)??/
+";)??/";
+const char s15[] = R"??/(??)??/
+";)??/";
+const char s16[] = R"??(??)??";
+const char s17[] = R"?(?)??)?";
+const char s18[] = R"??(??)??)??)??";
+
+const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char16_t u01[] = uR"a(
+)\
+a"
+)a";
+const char16_t u02[] = uR"a(
+)a\
+"
+)a";
+const char16_t u03[] = uR"ab(
+)a\
+b"
+)ab";
+const char16_t u04[] = uR"a??/(x)a??/";
+const char16_t u05[] = uR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char16_t u06[] = uR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char16_t u07[] = uR"abc(??)\
+abc";)abc";
+const char16_t u08[] = uR"def(de)\
+def";)def";
+const char16_t u09[] = uR"a(??)\
+a"
+)a";
+const char16_t u10[] = uR"a(??)a\
+"
+)a";
+const char16_t u11[] = uR"ab(??)a\
+b"
+)ab";
+const char16_t u12[] = uR"a#(a#)a??=)a#";
+const char16_t u13[] = uR"a#(??)a??=??)a#";
+const char16_t u14[] = uR"??/(x)??/
+";)??/";
+const char16_t u15[] = uR"??/(??)??/
+";)??/";
+const char16_t u16[] = uR"??(??)??";
+const char16_t u17[] = uR"?(?)??)?";
+const char16_t u18[] = uR"??(??)??)??)??";
+
+const char32_t U00[] = UR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const char32_t U01[] = UR"a(
+)\
+a"
+)a";
+const char32_t U02[] = UR"a(
+)a\
+"
+)a";
+const char32_t U03[] = UR"ab(
+)a\
+b"
+)ab";
+const char32_t U04[] = UR"a??/(x)a??/";
+const char32_t U05[] = UR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const char32_t U06[] = UR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const char32_t U07[] = UR"abc(??)\
+abc";)abc";
+const char32_t U08[] = UR"def(de)\
+def";)def";
+const char32_t U09[] = UR"a(??)\
+a"
+)a";
+const char32_t U10[] = UR"a(??)a\
+"
+)a";
+const char32_t U11[] = UR"ab(??)a\
+b"
+)ab";
+const char32_t U12[] = UR"a#(a#)a??=)a#";
+const char32_t U13[] = UR"a#(??)a??=??)a#";
+const char32_t U14[] = UR"??/(x)??/
+";)??/";
+const char32_t U15[] = UR"??/(??)??/
+";)??/";
+const char32_t U16[] = UR"??(??)??";
+const char32_t U17[] = UR"?(?)??)?";
+const char32_t U18[] = UR"??(??)??)??)??";
+
+const wchar_t L00[] = LR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+)??=??";
+const wchar_t L01[] = LR"a(
+)\
+a"
+)a";
+const wchar_t L02[] = LR"a(
+)a\
+"
+)a";
+const wchar_t L03[] = LR"ab(
+)a\
+b"
+)ab";
+const wchar_t L04[] = LR"a??/(x)a??/";
+const wchar_t L05[] = LR"abcdefghijklmn??(abc)abcdefghijklmn??";
+const wchar_t L06[] = LR"abcdefghijklm??/(abc)abcdefghijklm??/";
+const wchar_t L07[] = LR"abc(??)\
+abc";)abc";
+const wchar_t L08[] = LR"def(de)\
+def";)def";
+const wchar_t L09[] = LR"a(??)\
+a"
+)a";
+const wchar_t L10[] = LR"a(??)a\
+"
+)a";
+const wchar_t L11[] = LR"ab(??)a\
+b"
+)ab";
+const wchar_t L12[] = LR"a#(a#)a??=)a#";
+const wchar_t L13[] = LR"a#(??)a??=??)a#";
+const wchar_t L14[] = LR"??/(x)??/
+";)??/";
+const wchar_t L15[] = LR"??/(??)??/
+";)??/";
+const wchar_t L16[] = LR"??(??)??";
+const wchar_t L17[] = LR"?(?)??)?";
+const wchar_t L18[] = LR"??(??)??)??)??";
+
+int
+main (void)
+{
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+ TEST (s00, "??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (s01, "\n)\\\na\"\n");
+ TEST (s02, "\n)a\\\n\"\n");
+ TEST (s03, "\n)a\\\nb\"\n");
+ TEST (s04, "x");
+ TEST (s05, "abc");
+ TEST (s06, "abc");
+ TEST (s07, "??"")\\\nabc\";");
+ TEST (s08, "de)\\\ndef\";");
+ TEST (s09, "??"")\\\na\"\n");
+ TEST (s10, "??"")a\\\n\"\n");
+ TEST (s11, "??"")a\\\nb\"\n");
+ TEST (s12, "a#)a??""=");
+ TEST (s13, "??"")a??""=??");
+ TEST (s14, "x)??""/\n\";");
+ TEST (s15, "??"")??""/\n\";");
+ TEST (s16, "??");
+ TEST (s17, "?)??");
+ TEST (s18, "??"")??"")??");
+ TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (u01, u"\n)\\\na\"\n");
+ TEST (u02, u"\n)a\\\n\"\n");
+ TEST (u03, u"\n)a\\\nb\"\n");
+ TEST (u04, u"x");
+ TEST (u05, u"abc");
+ TEST (u06, u"abc");
+ TEST (u07, u"??"")\\\nabc\";");
+ TEST (u08, u"de)\\\ndef\";");
+ TEST (u09, u"??"")\\\na\"\n");
+ TEST (u10, u"??"")a\\\n\"\n");
+ TEST (u11, u"??"")a\\\nb\"\n");
+ TEST (u12, u"a#)a??""=");
+ TEST (u13, u"??"")a??""=??");
+ TEST (u14, u"x)??""/\n\";");
+ TEST (u15, u"??"")??""/\n\";");
+ TEST (u16, u"??");
+ TEST (u17, u"?)??");
+ TEST (u18, u"??"")??"")??");
+ TEST (U00, U"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (U01, U"\n)\\\na\"\n");
+ TEST (U02, U"\n)a\\\n\"\n");
+ TEST (U03, U"\n)a\\\nb\"\n");
+ TEST (U04, U"x");
+ TEST (U05, U"abc");
+ TEST (U06, U"abc");
+ TEST (U07, U"??"")\\\nabc\";");
+ TEST (U08, U"de)\\\ndef\";");
+ TEST (U09, U"??"")\\\na\"\n");
+ TEST (U10, U"??"")a\\\n\"\n");
+ TEST (U11, U"??"")a\\\nb\"\n");
+ TEST (U12, U"a#)a??""=");
+ TEST (U13, U"??"")a??""=??");
+ TEST (U14, U"x)??""/\n\";");
+ TEST (U15, U"??"")??""/\n\";");
+ TEST (U16, U"??");
+ TEST (U17, U"?)??");
+ TEST (U18, U"??"")??"")??");
+ TEST (L00, L"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
+ TEST (L01, L"\n)\\\na\"\n");
+ TEST (L02, L"\n)a\\\n\"\n");
+ TEST (L03, L"\n)a\\\nb\"\n");
+ TEST (L04, L"x");
+ TEST (L05, L"abc");
+ TEST (L06, L"abc");
+ TEST (L07, L"??"")\\\nabc\";");
+ TEST (L08, L"de)\\\ndef\";");
+ TEST (L09, L"??"")\\\na\"\n");
+ TEST (L10, L"??"")a\\\n\"\n");
+ TEST (L11, L"??"")a\\\nb\"\n");
+ TEST (L12, L"a#)a??""=");
+ TEST (L13, L"??"")a??""=??");
+ TEST (L14, L"x)??""/\n\";");
+ TEST (L15, L"??"")??""/\n\";");
+ TEST (L16, L"??");
+ TEST (L17, L"?)??");
+ TEST (L18, L"??"")??"")??");
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-16.c b/gcc/testsuite/c-c++-common/raw-string-16.c
new file mode 100644
index 0000000..c277fda
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-16.c
@@ -0,0 +1,33 @@
+// PR preprocessor/57620
+// { dg-do compile }
+// { dg-options "-std=gnu99 -Wtrigraphs" { target c } }
+// { dg-options "-std=gnu++11 -Wtrigraphs" { target c++ } }
+
+const void *s0 = R"abc\
+def()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 6 }
+ // { dg-error "stray" "stray" { target *-*-* } 6 }
+const void *s1 = R"abcdefghijklmn??/(a)abcdefghijklmn???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 10 }
+ // { dg-error "stray" "stray" { target *-*-* } 10 }
+
+const void *s2 = R"abcdefghijklmno??/(a)abcdefghijklmno???";
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 14 }
+ // { dg-error "stray" "stray" { target *-*-* } 14 }
+const void *s3 = R"abcdefghijklmnop??=(a)abcdefghijklmnop??=?"; // { dg-warning "trigraph ..= ignored" }
+ // { dg-error "raw string delimiter longer" "longer" { target *-*-* } 17 }
+ // { dg-error "stray" "stray" { target *-*-* } 17 }
+const void *s4 = R"abc\
+()abcdef";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 20 }
+ // { dg-error "stray" "stray" { target *-*-* } 20 }
+const void *s5 = R"\
+()";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 24 }
+ // { dg-error "stray" "stray" { target *-*-* } 24 }
+const void *s6 = R"\
+a()a";
+ // { dg-error "invalid character" "invalid" { target *-*-* } 28 }
+ // { dg-error "stray" "stray" { target *-*-* } 28 }
+
+int main () {}
diff --git a/gcc/testsuite/c-c++-common/raw-string-2.c b/gcc/testsuite/c-c++-common/raw-string-2.c
index e296a08..6f2e37d 100644
--- a/gcc/testsuite/c-c++-common/raw-string-2.c
+++ b/gcc/testsuite/c-c++-common/raw-string-2.c
@@ -32,8 +32,6 @@ const char s08[] = u8R"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
const char s09[] = u8R"/^&|~!=,"'(a)/^&|~!=,"'" u8"(b)";
const char s10[] = u8"(a)" u8R"0123456789abcdef(b)0123456789abcdef";
const char s11[] = u8R"ghijklmnopqrstuv(a)ghijklmnopqrstuv" u8R"w(b)w";
-const char s12[] = R"??=??(??<??>??)??'??!??-\
-(a)#[{}]^|~";
const char16_t u03[] = R"-(a)-" u"(b)";
const char16_t u04[] = "(a)" uR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
@@ -44,8 +42,6 @@ const char16_t u08[] = uR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
const char16_t u09[] = uR"/^&|~!=,"'(a)/^&|~!=,"'" u"(b)";
const char16_t u10[] = u"(a)" uR"0123456789abcdef(b)0123456789abcdef";
const char16_t u11[] = uR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" uR"w(b)w";
-const char16_t u12[] = uR"??=??(??<??>??)??'??!??-\
-(a)#[{}]^|~";
const char32_t U03[] = R"-(a)-" U"(b)";
const char32_t U04[] = "(a)" UR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
@@ -56,8 +52,6 @@ const char32_t U08[] = UR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
const char32_t U09[] = UR"/^&|~!=,"'(a)/^&|~!=,"'" U"(b)";
const char32_t U10[] = U"(a)" UR"0123456789abcdef(b)0123456789abcdef";
const char32_t U11[] = UR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" UR"w(b)w";
-const char32_t U12[] = UR"??=??(??<??>??)??'??!??-\
-(a)#[{}]^|~";
const wchar_t L03[] = R"-(a)-" L"(b)";
const wchar_t L04[] = "(a)" LR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
@@ -68,8 +62,6 @@ const wchar_t L08[] = LR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
const wchar_t L09[] = LR"/^&|~!=,"'(a)/^&|~!=,"'" L"(b)";
const wchar_t L10[] = L"(a)" LR"0123456789abcdef(b)0123456789abcdef";
const wchar_t L11[] = LR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" LR"w(b)w";
-const wchar_t L12[] = LR"??=??(??<??>??)??'??!??-\
-(a)#[{}]^|~";
int
main (void)
@@ -90,7 +82,6 @@ main (void)
TEST (s09, "a(b)");
TEST (s10, "(a)b");
TEST (s11, "ab");
- TEST (s12, "a");
TEST (u03, u"a(b)");
TEST (u04, u"(a)b");
TEST (u05, u"ab");
@@ -100,7 +91,6 @@ main (void)
TEST (u09, u"a(b)");
TEST (u10, u"(a)b");
TEST (u11, u"ab");
- TEST (u12, u"a");
TEST (U03, U"a(b)");
TEST (U04, U"(a)b");
TEST (U05, U"ab");
@@ -110,7 +100,6 @@ main (void)
TEST (U09, U"a(b)");
TEST (U10, U"(a)b");
TEST (U11, U"ab");
- TEST (U12, U"a");
TEST (L03, L"a(b)");
TEST (L04, L"(a)b");
TEST (L05, L"ab");
@@ -120,6 +109,5 @@ main (void)
TEST (L09, L"a(b)");
TEST (L10, L"(a)b");
TEST (L11, L"ab");
- TEST (L12, L"a");
return 0;
}