mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-22 21:15:40 -04:00

While clang allows declarations in for loop init statements in c89 and gnu89, gcc does not. So, we should probably warn if users care about gcc compatibility. Differential Revision: https://reviews.llvm.org/D47840 llvm-svn: 335927
16 lines
390 B
C
16 lines
390 B
C
// RUN: %clang_cc1 -std=c89 -fsyntax-only -verify %s
|
|
// RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
|
|
// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s -DC99
|
|
|
|
#ifdef C99
|
|
// expected-no-diagnostics
|
|
#endif
|
|
|
|
void foo() {
|
|
#ifndef C99
|
|
// expected-warning@+2{{GCC does not allow variable declarations in for loop initializers before C99}}
|
|
#endif
|
|
for (int i = 0; i < 10; i++)
|
|
;
|
|
}
|