31 lines · c
1// RUN: %clang_cc1 -fsyntax-only -std=c17 -Wc2x-compat -verify=c17 %s2// RUN: %clang_cc1 -fsyntax-only -std=c2x -Wpre-c2x-compat -verify=c2x %s3 4void test_label_in_func() {5 int x;6label1:7 x = 1;8label2: label3: label4:9} // c17-warning {{label at end of compound statement is a C23 extension}} \10 c2x-warning {{label at end of compound statement is incompatible with C standards before C23}}11 12int test_label_in_switch(int v) {13 switch (v) {14 case 1:15 return 1;16 case 2:17 return 2;18 case 3: case 4: case 5:19 } // c17-warning {{label at end of compound statement is a C23 extension}} \20 c2x-warning {{label at end of compound statement is incompatible with C standards before C23}}21 22 switch (v) {23 case 6:24 return 6;25 default:26 } // c17-warning {{label at end of compound statement is a C23 extension}} \27 c2x-warning {{label at end of compound statement is incompatible with C standards before C23}}28 29 return 0;30}31