[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / Parser / statements.c
blob8215f4c92a604e5107c39277ec6c553f7bdaf864
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
3 void test1() {
4 { ; { ;;}} ;;
7 void test2() {
8 if (0) { if (1) {} } else { }
10 do { } while (0);
12 while (0) while(0) do ; while(0);
14 for ((void)0;0;(void)0)
15 for (;;)
16 for ((void)9;0;(void)2)
18 for (int X = 0; 0; (void)0);
21 void test3() {
22 switch (0) {
24 case 4:
25 if (0) {
26 case 6: ;
28 default:
33 void test4() {
34 if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
36 int X; // declaration in a block.
38 foo: if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
41 typedef int t;
42 void test5() {
43 if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
45 t x = 0;
47 if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
51 void test6(void) {
52 do
53 . // expected-error {{expected expression}}
54 while (0);
57 int test7() {
58 return 4 // expected-error {{expected ';' after return statement}}
61 void test8() {
62 // Should not skip '}' and produce a "expected '}'" error.
63 undecl // expected-error {{use of undeclared identifier 'undecl'}}
66 int test9() {
67 int T[] = {1, 2, };
69 int X;
70 X = 0, // expected-error {{expected ';' after expression}}
74 X = 0, // expected-error {{expected ';' after expression}}
75 if (0)
78 return 4, // expected-error {{expected ';' after return statement}}