Skip to content

Commit 62ec818

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: emit an error when using predefined timestamp macros
Since commit fe7c36c ("Makefile: Build with -Werror=date-time if the compiler supports it"), use of __DATE__, __TIME__, and __TIMESTAMP__ has not been allowed. As this test is gcc version specific (> 4.9), it hasn't prevented a few new uses from creeping into the kernel sources. Make checkpatch complain about them. Signed-off-by: Joe Perches <joe@perches.com> Original-patch-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4638532 commit 62ec818

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/checkpatch.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5089,6 +5089,12 @@ sub process {
50895089
}
50905090
}
50915091

5092+
# check for uses of __DATE__, __TIME__, __TIMESTAMP__
5093+
while ($line =~ /\b(__(?:DATE|TIME|TIMESTAMP)__)\b/g) {
5094+
ERROR("DATE_TIME",
5095+
"Use of the '$1' macro makes the build non-deterministic\n" . $herecurr);
5096+
}
5097+
50925098
# check for use of yield()
50935099
if ($line =~ /\byield\s*\(\s*\)/) {
50945100
WARN("YIELD",

0 commit comments

Comments
 (0)