From: Knut Omang <knut.omang@oracle.com>
To: Jim Davis <jim.epost@gmail.com>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Michal Marek <mmarek@suse.com>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Subject: Re: [PATCH 2/7] kbuild: Add P= command line flag to run checkpatch
Date: Tue, 21 Nov 2017 09:10:34 +0100 [thread overview]
Message-ID: <1511251834.4822.113.camel@oracle.com> (raw)
In-Reply-To: <CA+r1Zhj295pmVTmh_TVMuy37qRQ7Q6Mxipk7vhyAVkuXFBU8uw@mail.gmail.com>
On Mon, 2017-11-20 at 17:00 -0700, Jim Davis wrote:
> On Mon, Nov 20, 2017 at 2:22 PM, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
>
> > Should it be possible to somehow keep the distinction between
> > the flags coming from KBUILD_CFLAGS and the pure CHECKFLAGS?
>
> Well, the practical problem seems to be that $(CHECK) is called in
> scripts/Makefile.build with both $(CHECKFLAGS) and $(c_flags) as
> arguments, regardless of what $(CHECK) is. That can be hacked around
> with something inelegant like
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index bb831d49bcfd..102194f9afb9 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -98,14 +98,20 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target)
> $(lib-target) $(extra-y)) \
> $(subdir-ym) $(always)
> @:
>
> -# Linus' kernel sanity checking tool
> +# Linus' kernel sanity checking tool, or $CHECK program of choice
> +ifneq ($(KBUILD_CHECKSRC),)
> + add_to_checkflags =
> + ifeq ($(CHECK),sparse)
> + add_to_checkflags = $(c_flags)
> + endif
> +endif
> ifneq ($(KBUILD_CHECKSRC),0)
> ifeq ($(KBUILD_CHECKSRC),2)
> quiet_cmd_force_checksrc = CHECK $<
> - cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
> + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(add_to_checkflags) $<
> ;
> else
> quiet_cmd_checksrc = CHECK $<
> - cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ;
> + cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(add_to_checkflags) $<
> ;
> endif
> endif
>
> and then if I run scripts/checkpatch.pl as $CHECK and pass --quiet
> --file as before it works -- until checkpatch returns with a non-zero
> exit code, which causes the Makefile to bail at that point.
yes, in an earlier version, I added a --no-errors flag to checkpatch to handle
that, but based on feedback this version promotes make -k instead. It seems
however that that only holds to the next linker step. It is useful to be able to
select whether checkpatch should cause make to stop or not. While fixing issues,
failure is a better strategy while to assess the state or generate a report, a
return 0 behavior is better.
> So maybe a wrapper script, with an exit 0 fixup to keep on keeping on
> in case of checkpatch warnings or errors, would be better after all.
I can prepare a v2 based on the wrapper script I have already.
In that version, all added functionality was implemented in the wrapper
(including the configuration file parsing)
Would you like to keep the checkpatch changes in some form, or would you rather
see everything happening in the wrapper?
A 3rd possibility that strikes me is that maybe what's needed is a general
checker runner that can also take care of running other checks, running multiple
checks, and maybe also handling temporary or decided suppression of sparse
errors in a similar fashion as I implemented for checkpatch errors. But maybe
that can be left to a later change set..
Thanks,
Knut
next prev parent reply other threads:[~2017-11-21 8:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-16 17:01 [PATCH 0/7] Support for automatic checkpatch running in the kernel Knut Omang
2017-11-16 17:01 ` [PATCH 1/7] checkpatch: Implement new --ignore-cfg parameter Knut Omang
2017-11-16 17:09 ` Joe Perches
2017-11-16 17:43 ` Knut Omang
2017-11-16 17:01 ` [PATCH 2/7] kbuild: Add P= command line flag to run checkpatch Knut Omang
2017-11-20 16:18 ` Masahiro Yamada
2017-11-20 19:48 ` Jim Davis
2017-11-20 20:08 ` Luc Van Oostenryck
2017-11-20 21:10 ` Knut Omang
2017-11-20 21:22 ` Luc Van Oostenryck
2017-11-21 0:00 ` Jim Davis
2017-11-21 8:10 ` Knut Omang [this message]
2017-11-21 19:48 ` Jim Davis
2017-11-21 20:03 ` Joe Perches
2017-11-20 21:04 ` Knut Omang
2017-11-16 17:01 ` [PATCH 3/7] checkpatch: Add a few convenience options to disable/modify features Knut Omang
2017-11-16 17:01 ` [PATCH 4/7] Documentation: Add documentation for the new P= Makefile option Knut Omang
2017-11-16 17:01 ` [PATCH 5/7] checkpatch: Improve --fix-inplace for TABSTOP Knut Omang
2017-11-16 17:01 ` [PATCH 6/7] checkpatch: Make --ignore-cfg look recursively for the file Knut Omang
2017-11-16 17:01 ` [PATCH 7/7] Documentation: Update checkpatch --ignore-cfg description Knut Omang
2017-11-16 22:57 ` [PATCH 0/7] Support for automatic checkpatch running in the kernel Kees Cook
2017-11-17 4:47 ` Knut Omang
2017-11-17 9:08 ` Knut Omang
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=1511251834.4822.113.camel@oracle.com \
--to=knut.omang@oracle.com \
--cc=apw@canonical.com \
--cc=jim.epost@gmail.com \
--cc=joe@perches.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=mmarek@suse.com \
--cc=yamada.masahiro@socionext.com \
/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