xref: /llvm-project/clang/test/Misc/diag-mapping2.c (revision 468c7b65e578dd8decc3d7a2f9dce88410503fd1)
1 // This should warn by default.
2 // RUN: %clang_cc1 %s 2>&1 | grep "warning: foo"
3 
4 // This should not emit anything.
5 // RUN: %clang_cc1 %s -w 2>&1 | not grep diagnostic
6 // RUN: %clang_cc1 %s -Wno-#warnings 2>&1 | not grep diagnostic
7 // RUN: %clang_cc1 %s -Wno-cpp 2>&1 | not grep diagnostic
8 
9 // -Werror can map all warnings to error.
10 // RUN: not %clang_cc1 %s -Werror 2>&1 | grep "error: foo"
11 
12 // -Werror can map this one warning to error.
13 // RUN: not %clang_cc1 %s -Werror=#warnings 2>&1 | grep "error: foo"
14 // RUN: not %clang_cc1 %s -Werror=#warnings -W#warnings 2>&1 | grep "error: foo"
15 
16 // -Wno-error= overrides -Werror. -Wno-error applies to a subsequent warning of the same name.
17 // RUN: %clang_cc1 %s -Werror -Wno-error=#warnings 2>&1 | grep "warning: foo"
18 // RUN: %clang_cc1 %s -Werror -Wno-error=#warnings -W#warnings 2>&1 | grep "warning: foo"
19 
20 // -Wno-error overrides -Werror.  PR4715
21 // RUN: %clang_cc1 %s -Werror -Wno-error 2>&1 | grep "warning: foo"
22 
23 #warning foo
24 
25