[PATCH 1/3] checkpatch: Check for use of disallowed macros

From: Rasmus Villemoes
Date: Fri Dec 12 2014 - 05:52:00 EST


Since fe7c36c7 ("Makefile: Build with -Werror=date-time if the
compiler supports it"), use of __DATE__, __TIME__, __TIMESTAMP__ has
been disallowed. This hasn't prevented a few new users from creeping
in. Make checkpatch complain.

Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f0bb6d60c07b..7fafd3b45539 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3008,6 +3008,12 @@ sub process {
$line =~ s@//.*@@;
$opline =~ s@//.*@@;

+
+# Use of __DATE__, __TIME__, __TIMESTAMP__ is not allowed
+ if ($line =~ m/\b__(?:DATE|TIME|TIMESTAMP)__\b/) {
+ ERROR("DATETIME", "Do not use the macros __DATE__, __TIME__ and __TIMESTAMP__\n" . $herecurr)
+ }
+
# EXPORT_SYMBOL should immediately follow the thing it is exporting, consider
# the whole statement.
#print "APW <$lines[$realline_next - 1]>\n";
--
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/