xref: /aosp_15_r20/external/clang/test/Misc/diag-mapping.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // This should warn by default.
2*67e74705SXin Li // RUN: %clang_cc1 %s 2>&1 | grep "warning:"
3*67e74705SXin Li // This should not emit anything.
4*67e74705SXin Li // RUN: %clang_cc1 %s -Wno-extra-tokens 2>&1 | not grep diagnostic
5*67e74705SXin Li 
6*67e74705SXin Li // -Werror can map all warnings to error.
7*67e74705SXin Li // RUN: not %clang_cc1 %s -Werror 2>&1 | grep "error:"
8*67e74705SXin Li 
9*67e74705SXin Li // -Werror can map this one warning to error.
10*67e74705SXin Li // RUN: not %clang_cc1 %s -Werror=extra-tokens 2>&1 | grep "error:"
11*67e74705SXin Li 
12*67e74705SXin Li // Mapping unrelated diags to errors doesn't affect this one.
13*67e74705SXin Li // RUN: %clang_cc1 %s -Werror=trigraphs 2>&1 | grep "warning:"
14*67e74705SXin Li 
15*67e74705SXin Li // This should stay a warning with -pedantic.
16*67e74705SXin Li // RUN: %clang_cc1 %s -pedantic 2>&1 | grep "warning:"
17*67e74705SXin Li 
18*67e74705SXin Li // This should emit an error with -pedantic-errors.
19*67e74705SXin Li // RUN: not %clang_cc1 %s -pedantic-errors 2>&1 | grep "error:"
20*67e74705SXin Li 
21*67e74705SXin Li // This should emit a warning, because -Wfoo overrides -pedantic*.
22*67e74705SXin Li // RUN: %clang_cc1 %s -pedantic-errors -Wextra-tokens 2>&1 | grep "warning:"
23*67e74705SXin Li 
24*67e74705SXin Li // This should emit nothing, because -Wno-extra-tokens overrides -pedantic*
25*67e74705SXin Li // RUN: %clang_cc1 %s -pedantic-errors -Wno-extra-tokens 2>&1 | not grep diagnostic
26*67e74705SXin Li 
27*67e74705SXin Li #ifdef foo
28*67e74705SXin Li #endif bad // extension!
29*67e74705SXin Li 
30*67e74705SXin Li int x;
31