xref: /llvm-project/clang/test/Sema/vla-ext.c (revision f8d448d5e587a23886c3226957f880146a4d8c69)
1 /* RUN: %clang_cc1 -verify=off -std=c89 %s
2  * RUN: %clang_cc1 -verify=off -Wall -std=c89 %s
3  * RUN: %clang_cc1 -verify -pedantic -std=c89 %s
4  * RUN: %clang_cc1 -verify -Wvla-extension -std=c89 %s
5  * RUN: %clang_cc1 -verify=off -Wvla-cxx-extension -std=c89 %s
6  * RUN: %clang_cc1 -verify=off -pedantic -std=c99 %s
7  * RUN: %clang_cc1 -verify=off -Wall -std=c99 %s
8  * RUN: %clang_cc1 -verify=off -std=c99 -Wvla-extension %s
9  * The next run line still issues the extension warning because VLAs are an
10  * extension in C89, but the line after it will issue the congratulatory
11  * diagnostic.
12  * RUN: %clang_cc1 -verify -Wvla -std=c89 %s
13  * RUN: %clang_cc1 -verify=wvla -Wvla -std=c99 %s
14  */
15 
16 /* off-no-diagnostics */
17 
func(int n)18 void func(int n) {
19   int array[n]; /* expected-warning {{variable length arrays are a C99 feature}}
20                    wvla-warning {{variable length array used}}
21                  */
22   (void)array;
23 }
24 
25