xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/Werror.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: rm -rf %t
2*0a6a1f1dSLionel Sambuc// RUN: rm -rf %t-saved
3*0a6a1f1dSLionel Sambuc// RUN: mkdir -p %t-saved
4*0a6a1f1dSLionel Sambuc
5*0a6a1f1dSLionel Sambuc// Initial module build (-Werror=header-guard)
6*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
7*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella  \
8*0a6a1f1dSLionel Sambuc// RUN:     -Werror=header-guard
9*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t-saved/Module.pcm
10*0a6a1f1dSLionel Sambuc
11*0a6a1f1dSLionel Sambuc// Building with looser -Werror options does not rebuild
12*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
13*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella
14*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t-saved/Module.pcm
15*0a6a1f1dSLionel Sambuc
16*0a6a1f1dSLionel Sambuc// Make the build more restricted (-Werror)
17*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
18*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
19*0a6a1f1dSLionel Sambuc// RUN:     -Werror -Wno-incomplete-umbrella
20*0a6a1f1dSLionel Sambuc// RUN: not diff %t/Module.pcm %t-saved/Module.pcm
21*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t-saved/Module.pcm
22*0a6a1f1dSLionel Sambuc
23*0a6a1f1dSLionel Sambuc// Ensure -Werror=header-guard is less strict than -Werror
24*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
25*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
26*0a6a1f1dSLionel Sambuc// RUN:     -Werror=header-guard -Wno-incomplete-umbrella
27*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t-saved/Module.pcm
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc// But -Werror=unused is not, because some of its diags are DefaultIgnore
30*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
31*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
32*0a6a1f1dSLionel Sambuc// RUN:     -Werror=unused
33*0a6a1f1dSLionel Sambuc// RUN: not diff %t/Module.pcm %t-saved/Module.pcm
34*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t-saved/Module.pcm
35*0a6a1f1dSLionel Sambuc
36*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
37*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
38*0a6a1f1dSLionel Sambuc// RUN:     -Werror -Wno-incomplete-umbrella
39*0a6a1f1dSLionel Sambuc
40*0a6a1f1dSLionel Sambuc// FIXME: when rebuilding the module, take the union of the diagnostic options
41*0a6a1f1dSLionel Sambuc// so that we don't need to rebuild here
42*0a6a1f1dSLionel Sambuc// RUN-DISABLED: diff %t/Module.pcm %t-saved/Module.pcm
43*0a6a1f1dSLionel Sambuc
44*0a6a1f1dSLionel Sambuc// -Wno-everything, -Werror
45*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
46*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
47*0a6a1f1dSLionel Sambuc// RUN:     -Wno-everything -Wall -Werror
48*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t-saved/Module.pcm
49*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
50*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
51*0a6a1f1dSLionel Sambuc// RUN:     -Wall -Werror
52*0a6a1f1dSLionel Sambuc// RUN: not diff %t/Module.pcm %t-saved/Module.pcm
53*0a6a1f1dSLionel Sambuc
54*0a6a1f1dSLionel Sambuc// -pedantic, -Werror is not compatible with -Wall -Werror
55*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
56*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
57*0a6a1f1dSLionel Sambuc// RUN:     -Werror -pedantic
58*0a6a1f1dSLionel Sambuc// RUN: not diff %t/Module.pcm %t-saved/Module.pcm
59*0a6a1f1dSLionel Sambuc// RUN: cp %t/Module.pcm %t-saved/Module.pcm
60*0a6a1f1dSLionel Sambuc
61*0a6a1f1dSLionel Sambuc// -pedantic-errors is less strict that -pedantic, -Werror
62*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
63*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
64*0a6a1f1dSLionel Sambuc// RUN:     -pedantic-errors
65*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t-saved/Module.pcm
66*0a6a1f1dSLionel Sambuc
67*0a6a1f1dSLionel Sambuc// -Wsystem-headers does not affect non-system modules
68*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
69*0a6a1f1dSLionel Sambuc// RUN:     -F %S/Inputs -fsyntax-only %s -verify -Wno-incomplete-umbrella \
70*0a6a1f1dSLionel Sambuc// RUN:     -pedantic-errors -Wsystem-headers
71*0a6a1f1dSLionel Sambuc// RUN: diff %t/Module.pcm %t-saved/Module.pcm
72*0a6a1f1dSLionel Sambuc
73*0a6a1f1dSLionel Sambuc// expected-no-diagnostics
74*0a6a1f1dSLionel Sambuc@import Module;
75