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