| 1 |
// RUN: %clang_cc1 -fsyntax-only -std=gnu11 -verify=supported %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -std=c11 -DUNICODE -fraw-string-literals -verify=supported %s |
| 3 |
// RUN: %clang_cc1 -fsyntax-only -std=gnu89 -verify=unsupported %s |
| 4 |
// RUN: %clang_cc1 -fsyntax-only -std=c11 -DUNICODE -verify=unsupported %s |
| 5 |
// RUN: %clang_cc1 -fsyntax-only -std=gnu11 -DUNICODE -fno-raw-string-literals -verify=unsupported %s |
| 6 |
|
| 7 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=c++03 -verify=unsupported,cxx-unsupported %s |
| 8 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=gnu++03 -verify=unsupported,cxx-unsupported %s |
| 9 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=c++03 -fraw-string-literals -verify=supported %s |
| 10 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=gnu++03 -fraw-string-literals -verify=supported %s |
| 11 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=c++11 -DUNICODE -verify=supported,cxx %s |
| 12 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=gnu++11 -DUNICODE -verify=supported,cxx %s |
| 13 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=c++11 -DUNICODE -fraw-string-literals -verify=supported,yes %s |
| 14 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=gnu++11 -DUNICODE -fraw-string-literals -verify=supported,yes %s |
| 15 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=c++11 -DUNICODE -fno-raw-string-literals -verify=supported,no %s |
| 16 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -Wno-unused -std=gnu++11 -DUNICODE -fno-raw-string-literals -verify=supported,no %s |
| 17 |
|
| 18 |
// GCC supports raw string literals in C99 and later in '-std=gnuXY' mode; we |
| 19 |
// additionally provide '-f[no-]raw-string-literals' to enable/disable them |
| 20 |
// explicitly in C. |
| 21 |
// |
| 22 |
// We do not allow disabling raw string literals in C++ mode if they’re enabled |
| 23 |
// by the language standard, i.e. in C++11 or later. |
| 24 |
|
| 25 |
// Driver warnings. |
| 26 |
// yes-warning@* {{ignoring '-fraw-string-literals'}} |
| 27 |
// no-warning@* {{ignoring '-fno-raw-string-literals'}} |
| 28 |
|
| 29 |
void f() { |
| 30 |
(void) R"foo()foo"; // unsupported-error {{use of undeclared identifier 'R'}} |
| 31 |
(void) LR"foo()foo"; // unsupported-error {{use of undeclared identifier 'LR'}} |
| 32 |
|
| 33 |
#ifdef UNICODE |
| 34 |
(void) uR"foo()foo"; // unsupported-error {{use of undeclared identifier 'uR'}} |
| 35 |
(void) u8R"foo()foo"; // unsupported-error {{use of undeclared identifier 'u8R'}} |
| 36 |
(void) UR"foo()foo"; // unsupported-error {{use of undeclared identifier 'UR'}} |
| 37 |
#endif |
| 38 |
} |
| 39 |
|
| 40 |
// supported-error@* {{missing terminating delimiter}} |
| 41 |
// supported-error@* {{expected expression}} |
| 42 |
// supported-error@* {{expected ';' after top level declarator}} |
| 43 |
#define R "bar" |
| 44 |
const char* s = R"foo("; |