Skip to content

Commit 7bacdf8

Browse files
akyrtzibenlangmuir
authored andcommitted
[clang/DiagnosticLexKinds] Mark -Wreproducible-caching as DefaultWarnNoWerror/ShowInSystemHeader/ShowInSystemMacro
This allows the warning to be visible during a caching invocation by default, without getting affected by -Werror. (cherry picked from commit f31ea45)
1 parent f11b5e7 commit 7bacdf8

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,8 @@ def warn_pp_date_time : Warning<
764764

765765
def warn_pp_encounter_nonreproducible: Warning<
766766
"encountered non-reproducible token, caching will be skipped">,
767-
InGroup<DiagGroup<"reproducible-caching">>, DefaultIgnore;
767+
InGroup<DiagGroup<"reproducible-caching">>,
768+
DefaultWarnNoWerror, ShowInSystemHeader, ShowInSystemMacro;
768769
def err_pp_encounter_nonreproducible: Error<
769770
"encountered non-reproducible token, caching failed">;
770771

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: rm -rf %t && mkdir -p %t
2+
// RUN: split-file %s %t
3+
4+
// No warning in normal invocation.
5+
// RUN: %clang -target x86_64-apple-macos11 -fsyntax-only %t/t.c -isystem %t/sys 2>&1 | FileCheck %s --check-prefix=NOWARN --allow-empty
6+
// NOWARN-NOT: warning
7+
8+
// Warning in cached invocation even if coming from system header. -Werror does not affect it.
9+
// RUN: %clang -target x86_64-apple-macos11 -c %t/t.c -o %t/t.o -isystem %t/sys -Werror \
10+
// RUN: -fdepscan=inline -Xclang -fcas-path -Xclang %t/cas -Xclang -fcache-compile-job 2>&1 | FileCheck %s --check-prefix=WARN
11+
// WARN: warning: encountered non-reproducible token
12+
13+
// Error if explicitly turned into error.
14+
// RUN: not %clang -target x86_64-apple-macos11 -c %t/t.c -o %t/t.o -isystem %t/sys -Werror=reproducible-caching \
15+
// RUN: -fdepscan=inline -Xclang -fcas-path -Xclang %t/cas -Xclang -fcache-compile-job 2>&1 | FileCheck %s --check-prefix=ERROR
16+
// ERROR: error: encountered non-reproducible token
17+
18+
//--- t.c
19+
#include <sys.h>
20+
21+
//--- sys/sys.h
22+
const char *foo() {
23+
return __DATE__;
24+
}

0 commit comments

Comments
 (0)