[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / Parser / pragma-weak.c
blobfd47dd8696b86214912ace19a18e70987d2802eb
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Note that this puts the expected lines before the directives to work around
4 // limitations in the -verify mode.
6 int x;
7 /* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak
8 #pragma weak x
10 extern int z;
11 /* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak z = =
12 /* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak z =
13 /* expected-warning {{weak identifier 'y' never declared}} */ #pragma weak z = y
15 extern int a;
16 /* expected-warning {{extra tokens at end of '#pragma weak'}}*/ #pragma weak a b
17 /* expected-warning {{extra tokens at end of '#pragma weak'}}*/ #pragma weak a = x c
20 void pragma_is_not_a_statement(int x)
22 int t;
25 if (x)
26 #pragma weak t
27 else // expected-error {{expected expression}}
28 #pragma weak t
31 switch (x) {
32 case 1:
33 #pragma weak t
34 } // expected-error {{expected statement}}
35 switch(x) {
36 default:
37 #pragma weak t
38 } // expected-error {{expected statement}}
40 label:
41 #pragma weak t
42 } // expected-error {{expected statement}}