[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / C / drs / dr324.c
blob585041b0365f35ec26bff6293d40808c9c27369c
1 /* RUN: rm -rf %t && mkdir %t
2 RUN: cp %s %t/dr324.c
4 Note: this file (dr324.c) must be newer than the file used for the
5 dependency pragma (dep.c), otherwise we get an unrelated "current file is
6 older than dependency" warning. Touch dep.c first to make sure it's
7 always older.
8 RUN: touch %t/dep.c
9 RUN: touch %t/dr324.c
11 RUN: %clang_cc1 -std=c89 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
12 RUN: %clang_cc1 -std=c99 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
13 RUN: %clang_cc1 -std=c11 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
14 RUN: %clang_cc1 -std=c17 -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
15 RUN: %clang_cc1 -std=c2x -fsyntax-only -fms-extensions -pedantic -verify %t/dr324.c
18 /* WG14 DR324: yes
19 * Tokenization obscurities
22 /* We need to diagnose an unknown escape sequence in a string or character
23 * literal, but not within a header-name terminal.
25 const char *lit_str = "\y"; /* expected-warning {{unknown escape sequence '\y'}} */
26 char lit_char = '\y'; /* expected-warning {{unknown escape sequence '\y'}} */
28 /* This gets trickier in a pragma where there are implementation-defined
29 * locations that may use a header-name production. The first pragma below
30 * is using \d but it's in a header-name use rather than a string-literal use.
31 * The second pragma is a string-literal and so the \d is invalid there.
33 #ifdef _WIN32
34 /* This test only makes sense on Windows targets, where the backslash is a valid
35 * path separator.
37 #pragma GCC dependency "oops\..\dep.c"
38 #endif
39 #pragma message("this has a \t tab escape and an invalid \d escape") /* expected-warning {{this has a tab escape and an invalid d escape}}
40 expected-warning {{unknown escape sequence '\d'}}
44 * Note, this tests the behavior of a non-empty source file that ends with a
45 * partial preprocessing token such as an unterminated string or character
46 * literal. Thus, it is important that no code be added after this test case.
48 /* expected-error@+3 {{expected identifier or '('}}
49 expected-warning@+3 {{missing terminating ' character}}