brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 1b9b6b6 Raw
49 lines · c
1// RUN: %clang_cc1 -fsyntax-only -std=c17 -DTEST_SPELLING -Wc2x-compat -verify=c17 %s2// RUN: %clang_cc1 -fsyntax-only -std=c17 -DTEST_SPELLING -fms-compatibility -verify=c17-ms %s3// RUN: %clang_cc1 -fsyntax-only -std=c2x -Wpre-c2x-compat -verify=c2x-compat %s4// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify=c99 %s5// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic -verify=c99-pedantic %s6// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify=cxx17 -x c++ %s7// RUN: %clang_cc1 -fsyntax-only -std=c++17 -pedantic -verify=cxx17-pedantic -x c++ %s8// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify=cxx98 -x c++ %s9// RUN: %clang_cc1 -fsyntax-only -std=c++98 -pedantic -verify=cxx98-pedantic -x c++ %s10// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wpre-c++17-compat -verify=cxx17-compat -x c++ %s11 12// cxx17-no-diagnostics13 14#ifdef TEST_SPELLING15// Only test the C++ spelling in C mode in some of the tests, to reduce the16// amount of diagnostics to have to check. This spelling is allowed in MS-17// compatibility mode in C, but otherwise produces errors.18static_assert(1, ""); // c17-warning {{'static_assert' is a keyword in C23}} \19                      // c17-error {{expected parameter declarator}} \20                      // c17-error {{expected ')'}} \21                      // c17-note {{to match this '('}} \22                      // c17-error {{type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int}} \23 24#endif25 26// We support _Static_assert as an extension in older C modes and in all C++27// modes, but only as a pedantic warning.28_Static_assert(1, ""); // c99-pedantic-warning {{'_Static_assert' is a C11 extension}} \29                       // cxx17-pedantic-warning {{'_Static_assert' is a C11 extension}} \30                       // cxx98-pedantic-warning {{'_Static_assert' is a C11 extension}}31 32// _Static_assert without a message has more complex diagnostic logic:33//   * In C++17 or C2x mode, it's supported by default.34//   * But there is a special compat warning flag to warn about portability to35//     older standards.36//   * In older standard pedantic modes, warn about supporting without a37//     message as an extension.38_Static_assert(1); // c99-pedantic-warning {{'_Static_assert' with no message is a C23 extension}} \39                   // c99-warning {{'_Static_assert' with no message is a C23 extension}} \40                   // cxx98-pedantic-warning {{'static_assert' with no message is a C++17 extension}} \41                   // cxx98-warning {{'static_assert' with no message is a C++17 extension}} \42                   // c2x-compat-warning {{'_Static_assert' with no message is incompatible with C standards before C23}} \43                   // cxx17-compat-warning {{'static_assert' with no message is incompatible with C++ standards before C++17}} \44                   // c99-pedantic-warning {{'_Static_assert' is a C11 extension}} \45                   // cxx17-pedantic-warning {{'_Static_assert' is a C11 extension}} \46                   // cxx98-pedantic-warning {{'_Static_assert' is a C11 extension}} \47                   // c17-warning {{'_Static_assert' with no message is a C23 extension}} \48                   // c17-ms-warning {{'_Static_assert' with no message is a C23 extension}}49