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