LKML Archive on lore.kernel.org
 help / Atom feed
* [PATCH] checkpatch: allow reporting C99 style comments
@ 2019-01-10  5:01 Vadim Bendebury
  2019-01-10 20:24 ` Joe Perches
  2019-01-10 22:49 ` Vadim Bendebury
  0 siblings, 2 replies; 5+ messages in thread
From: Vadim Bendebury @ 2019-01-10  5:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: apw, joe, Vadim Bendebury

Presently C99 style comments are removed unconditionally before actual
patch validity check happens. This is a problem for some third party
projects which use checkpatch.pl but do not allow C99 style comments.

This patch adds yet another variable, named C99_COMMENT_TOLERANCE. If
it is included in the --ignore command line or config file options
list, C99 comments in the patch are reported as errors.

Tested by processing a patch with a C99 style comment, it passes the
check just fine unless '--ignore C99_COMMENT_TOLERANCE' is present in
.checkpatch.conf.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..c5fe10934080 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -61,7 +61,6 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
 my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
-my $allow_c99_comments = 1;
 
 sub help {
 	my ($exitcode) = @_;
@@ -1250,6 +1249,8 @@ sub sanitise_line {
 	my $off = 0;
 	my $c;
 
+	my $allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
+
 	# Always copy over the diff marker.
 	$res = substr($line, 0, 1);
 
-- 
2.20.1.97.g81188d93c3-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: allow reporting C99 style comments
  2019-01-10  5:01 [PATCH] checkpatch: allow reporting C99 style comments Vadim Bendebury
@ 2019-01-10 20:24 ` Joe Perches
  2019-01-10 22:49 ` Vadim Bendebury
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2019-01-10 20:24 UTC (permalink / raw)
  To: Vadim Bendebury, linux-kernel; +Cc: apw

On Wed, 2019-01-09 at 21:01 -0800, Vadim Bendebury wrote:
> Presently C99 style comments are removed unconditionally before actual
> patch validity check happens. This is a problem for some third party
> projects which use checkpatch.pl but do not allow C99 style comments.
> 
> This patch adds yet another variable, named C99_COMMENT_TOLERANCE. If
> it is included in the --ignore command line or config file options
> list, C99 comments in the patch are reported as errors.
> 
> Tested by processing a patch with a C99 style comment, it passes the
> check just fine unless '--ignore C99_COMMENT_TOLERANCE' is present in
> .checkpatch.conf.

I'm not a big fan of the name but I can't think of
anything much better.

And the location of the added test isn't good.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -61,7 +61,6 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
>  my $conststructsfile = "$D/const_structs.checkpatch";
>  my $typedefsfile = "";
>  my $color = "auto";
> -my $allow_c99_comments = 1;

Keep this here.
 
>  sub help {
>  	my ($exitcode) = @_;
> @@ -1250,6 +1249,8 @@ sub sanitise_line {
>  	my $off = 0;
>  	my $c;
>  
> +	my $allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
> +

And add this test as a new line near line 1015 like

 my $vname;
+$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
 for my $filename (@ARGV) {



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] checkpatch: allow reporting C99 style comments
  2019-01-10  5:01 [PATCH] checkpatch: allow reporting C99 style comments Vadim Bendebury
  2019-01-10 20:24 ` Joe Perches
@ 2019-01-10 22:49 ` Vadim Bendebury
  2019-01-10 23:16   ` Joe Perches
  1 sibling, 1 reply; 5+ messages in thread
From: Vadim Bendebury @ 2019-01-10 22:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: apw, joe, Vadim Bendebury

Presently C99 style comments are removed unconditionally before actual
patch validity check happens. This is a problem for some third party
projects which use checkpatch.pl but do not allow C99 style comments.

This patch adds yet another variable, named C99_COMMENT_TOLERANCE. If
it is included in the --ignore command line or config file options
list, C99 comments in the patch are reported as errors.

Tested by processing a patch with a C99 style comment, it passes the
check just fine unless '--ignore C99_COMMENT_TOLERANCE' is present in
.checkpatch.conf.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
---
 scripts/checkpatch.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..8a1aaeb8fa1b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -61,7 +61,7 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
 my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
-my $allow_c99_comments = 1;
+my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
 
 sub help {
 	my ($exitcode) = @_;
@@ -1011,6 +1011,7 @@ if ($git) {
 }
 
 my $vname;
+$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
 for my $filename (@ARGV) {
 	my $FILE;
 	if ($git) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: allow reporting C99 style comments
  2019-01-10 22:49 ` Vadim Bendebury
@ 2019-01-10 23:16   ` Joe Perches
       [not found]     ` <CAC3GErFi6Hg-E81wpwDV6gpWD0pxM6Rcbj-J9Q6Rs1FOuZ3fNA@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2019-01-10 23:16 UTC (permalink / raw)
  To: Vadim Bendebury, linux-kernel, Andrew Morton; +Cc: apw

On Thu, 2019-01-10 at 14:49 -0800, Vadim Bendebury wrote:
> Presently C99 style comments are removed unconditionally before actual
> patch validity check happens. This is a problem for some third party
> projects which use checkpatch.pl but do not allow C99 style comments.
> 
> This patch adds yet another variable, named C99_COMMENT_TOLERANCE. If
> it is included in the --ignore command line or config file options
> list, C99 comments in the patch are reported as errors.
> 
> Tested by processing a patch with a C99 style comment, it passes the
> check just fine unless '--ignore C99_COMMENT_TOLERANCE' is present in
> .checkpatch.conf.
> 
> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>

Seems sensible enough.

> ---
>  scripts/checkpatch.pl | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index b737ca9d7204..8a1aaeb8fa1b 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -61,7 +61,7 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt";
>  my $conststructsfile = "$D/const_structs.checkpatch";
>  my $typedefsfile = "";
>  my $color = "auto";
> -my $allow_c99_comments = 1;
> +my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
>  
>  sub help {
>  	my ($exitcode) = @_;
> @@ -1011,6 +1011,7 @@ if ($git) {
>  }
>  
>  my $vname;
> +$allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
>  for my $filename (@ARGV) {
>  	my $FILE;
>  	if ($git) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: allow reporting C99 style comments
       [not found]     ` <CAC3GErFi6Hg-E81wpwDV6gpWD0pxM6Rcbj-J9Q6Rs1FOuZ3fNA@mail.gmail.com>
@ 2019-01-11 19:11       ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2019-01-11 19:11 UTC (permalink / raw)
  To: Vadim Bendebury; +Cc: linux-kernel, Andrew Morton, apw

On Fri, 2019-01-11 at 10:07 -0800, Vadim Bendebury wrote:
> Joe,
> 
> what are next steps to get this merged

Generally, Andrew Morton will pick it up
and merge it in the next major release.

>  - do I have to do anything,

Be patient.

> is anything still missing?

I think not.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10  5:01 [PATCH] checkpatch: allow reporting C99 style comments Vadim Bendebury
2019-01-10 20:24 ` Joe Perches
2019-01-10 22:49 ` Vadim Bendebury
2019-01-10 23:16   ` Joe Perches
     [not found]     ` <CAC3GErFi6Hg-E81wpwDV6gpWD0pxM6Rcbj-J9Q6Rs1FOuZ3fNA@mail.gmail.com>
2019-01-11 19:11       ` Joe Perches

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox