mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Andy Whitcroft <apw@canonical.com>,
	Josh Triplett <josh@joshtriplett.org>,
	linux-kernel@vger.kernel.org
Subject: checkpatch: Emit an error when using predefined timestamp macros
Date: Thu, 18 Dec 2014 14:17:08 -0800	[thread overview]
Message-ID: <1418941028.28384.18.camel@perches.com> (raw)
In-Reply-To: <1418938012.28384.16.camel@perches.com>

Since commit fe7c36c7bde1 ("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.

Original-patch-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f0bb6d6..501c286 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5089,6 +5089,12 @@ sub process {
 			}
 		}
 
+# check for uses of __DATE__, __TIME__, __TIMESTAMP__
+		while ($line =~ /\b(__(?:DATE|TIME|TIMESTAMP)__)\b/g) {
+			ERROR("DATE_TIME",
+			      "Use of the '$1' macro makes the build non-deterministic\n" . $herecurr);
+		}
+
 # check for use of yield()
 		if ($line =~ /\byield\s*\(\s*\)/) {
 			WARN("YIELD",




      reply	other threads:[~2014-12-18 22:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 10:51 [PATCH 1/3] checkpatch: Check for use of disallowed macros Rasmus Villemoes
2014-12-12 10:51 ` [PATCH 2/3] staging: unisys: remove leftover __DATE__ Rasmus Villemoes
2014-12-12 10:51 ` [PATCH 3/3] ACPICA: Remove use of __DATE__ macro Rasmus Villemoes
2015-01-05  8:47   ` Zheng, Lv
2015-01-05 10:26     ` Rasmus Villemoes
2015-01-06  0:30       ` Zheng, Lv
2015-01-06 19:36         ` [Devel] " David E. Box
2015-01-13  2:33           ` Zheng, Lv
2015-01-13  5:42             ` Zheng, Lv
2014-12-12 11:16 ` [PATCH 1/3] checkpatch: Check for use of disallowed macros Joe Perches
2014-12-18 21:15   ` Rasmus Villemoes
2014-12-18 21:26     ` Joe Perches
2014-12-18 22:17       ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418941028.28384.18.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome