brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · b8a7dc1 Raw
39 lines · c
1/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic %s2 */3/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -Wdeclaration-after-statement %s4 */5/* RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -Wdeclaration-after-statement %s6 */7/* RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -Wdeclaration-after-statement %s8 */9 10/* Should not emit diagnostic when not pedantic, not enabled or in C++ Code*/11/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c89 %s12 */13/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 %s14 */15/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c89 -Wall %s16 */17/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 -Wall -pedantic %s18 */19/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c11 -Wall -pedantic %s20 */21/* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ %s22 */23/* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ -Wdeclaration-after-statement %s24 */25 26/* none-no-diagnostics */27 28int foo(int i)29{30  i += 1;31  int f = i;32#if __STDC_VERSION__ < 199901L33  /* expected-warning@-2 {{mixing declarations and code is a C99 extension}}*/34#else35  /* expected-warning@-4 {{mixing declarations and code is incompatible with standards before C99}}*/36#endif37  return f;38}39