All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] checkpatch: Check for use of disallowed macros
Date: Fri, 12 Dec 2014 03:16:44 -0800	[thread overview]
Message-ID: <1418383004.18092.46.camel@perches.com> (raw)
In-Reply-To: <1418381488-25123-1-git-send-email-linux@rasmusvillemoes.dk>

On Fri, 2014-12-12 at 11:51 +0100, Rasmus Villemoes wrote:
> 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.
[]
> diff --git 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)

I'd probably add that adjacent to the existing __FUNCTION__
test near line 5000 and make the test show the specific macro
used.

Maybe add __LINE__ and __FILE__ as a separate --strict test too.

Also the error message should should show the specific macro and
if __DATE__ and __TIME__ are on the same line, the error should
be emitted twice.

Maybe:
		while ($line =~ /\b(__(?:DATE|TIME|TIMESTAMP)__)\b/g) {
			ERROR("DATETIME",
			      "Do not use the $1 macro\n" . $herecurr);
		}
 


  parent reply	other threads:[~2014-12-12 11:16 UTC|newest]

Thread overview: 19+ 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   ` [Devel] " Zheng, Lv
2015-01-05  8:47     ` Zheng, Lv
2015-01-05 10:26     ` Rasmus Villemoes
2015-01-05 10:26       ` Rasmus Villemoes
2014-12-12 11:16 ` Joe Perches [this message]
2014-12-18 21:15   ` [PATCH 1/3] checkpatch: Check for use of disallowed macros Rasmus Villemoes
2014-12-18 21:26     ` Joe Perches
2014-12-18 22:17       ` checkpatch: Emit an error when using predefined timestamp macros Joe Perches
  -- strict thread matches above, loose matches on Subject: below --
2015-01-06  0:30 [Devel] [PATCH 3/3] ACPICA: Remove use of __DATE__ macro Zheng, Lv
2015-01-06  0:30 ` Zheng, Lv
2015-01-06 19:36 [Devel] " David E. Box
2015-01-06 19:36 ` David E. Box
2015-01-13  2:33 Zheng, Lv
2015-01-13  2:33 ` Zheng, Lv
2015-01-13  5:42 Zheng, Lv
2015-01-13  5:42 ` Zheng, Lv

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=1418383004.18092.46.camel@perches.com \
    --to=joe@perches.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.