brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · e7d16c8 Raw
53 lines · c
1// RUN: %clang_cc1 %s -Eonly -Wundef -verify=undef2// RUN: %clang_cc1 %s -Eonly -Wundef-prefix=A,BC -verify=undef-prefix3// RUN: %clang_cc1 %s -Eonly -Wundef -Wundef-prefix=A,BC -verify=both4// RUN: %clang_cc1 %s -Eonly -Werror=undef -verify=undef-error5// RUN: %clang_cc1 %s -Eonly -Werror=undef-prefix -Wundef-prefix=A,BC -verify=undef-prefix-error6// RUN: %clang_cc1 %s -Eonly -Werror=undef -Wundef-prefix=A,BC -verify=both-error7 8extern int x;9 10#if AB // #111#endif12// undef-warning@#1 {{'AB' is not defined, evaluates to 0}}13// undef-prefix-warning@#1 {{'AB' is not defined, evaluates to 0}}14// both-warning@#1 {{'AB' is not defined, evaluates to 0}}15// undef-error-error@#1 {{'AB' is not defined, evaluates to 0}}16// undef-prefix-error-error@#1 {{'AB' is not defined, evaluates to 0}}17// both-error-error@#1 {{'AB' is not defined, evaluates to 0}}18 19#if B // #220#endif21// undef-warning@#2 {{'B' is not defined, evaluates to 0}}22// no warning for undef-prefix23// both-warning@#2 {{'B' is not defined, evaluates to 0}}24// undef-error-error@#2 {{'B' is not defined, evaluates to 0}}25// no error for undef-prefix26// both-error-error@#2 {{'B' is not defined, evaluates to 0}}27 28#define BC 029#if BC // no warning/error30#endif31 32#undef BC33#if BC // #334#endif35// undef-warning@#3 {{'BC' is not defined, evaluates to 0}}36// undef-prefix-warning@#3 {{'BC' is not defined, evaluates to 0}}37// both-warning@#3 {{'BC' is not defined, evaluates to 0}}38// undef-error-error@#3 {{'BC' is not defined, evaluates to 0}}39// undef-prefix-error-error@#3 {{'BC' is not defined, evaluates to 0}}40// both-error-error@#3 {{'BC' is not defined, evaluates to 0}}41 42// Test that #pragma-enabled 'Wundef' can override 'Wundef-prefix'43#pragma clang diagnostic error "-Wundef"44 45#if C // #446#endif47// undef-error@#4 {{'C' is not defined, evaluates to 0}}48// undef-prefix-error@#4 {{'C' is not defined, evaluates to 0}}49// both-error@#4 {{'C' is not defined, evaluates to 0}}50// undef-error-error@#4 {{'C' is not defined, evaluates to 0}}51// undef-prefix-error-error@#4 {{'C' is not defined, evaluates to 0}}52// both-error-error@#4 {{'C' is not defined, evaluates to 0}}53