linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Palix <npalix@diku.dk>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Michal Marek <mmarek@suse.cz>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Roland Dreier <rdreier@cisco.com>, Joe Perches <joe@perches.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Julia Lawall <julia@diku.dk>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	cocci@diku.dk, Wolfram Sang <w.sang@pengutronix.de>,
	Kernel Janitors <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 1/4] Add targets to use the Coccinelle checker
Date: Fri, 4 Jun 2010 11:56:20 +0200	[thread overview]
Message-ID: <201006041156.20714.npalix@diku.dk> (raw)
In-Reply-To: <20100603102315.GA8002@merkur.ravnborg.org>

On Thursday 03 June 2010 12:23:15 Sam Ravnborg wrote:
> On Mon, May 10, 2010 at 06:24:24PM +0200, Nicolas Palix wrote:
> > Four targets are added. Each one generates a different
> > output kind: context, patch, org, report.
> > Every SmPL file in 'scripts/coccinelle' is given to the spatch frontend
> > (located in the 'scripts' directory), and applied to the entire
> > source tree.
> 
> A little late feedback.
> IIRC all points raised at first review has been addressed - good.
> 
> > 
> > Signed-off-by: Nicolas Palix <npalix@diku.dk>
> > Signed-off-by: Julia Lawall <julia@diku.dk>
> > ---
> >  MAINTAINERS           |   10 ++++++++++
> >  Makefile              |   20 ++++++++++++++++++--
> 
> The top-level Makefile is already in a very bad shape.
> Adding more stuff there is never good.
> 
> How about adding some infrastructure to support the various tools?
> Something along these lines:
> 
> All targets named %check will call a shell script:
> scripts/%check.sh
> 
> "make help" will call a script named:
> scripts/helpcheck.sh
> 
> helpcheck.sh will contain all the ugly details
> about help for the various targets.
> 
> We need to rename a few seldomly used targets to do this.
> Sample patch for top-level Makefile:
> 
> diff --git a/Makefile b/Makefile
> index efdc3d0..40bf83e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -412,7 +412,7 @@ endif
>  # of make so .config is not included in this case either (for *config).
>  
>  no-dot-config-targets := clean mrproper distclean \
> -			 cscope TAGS tags help %docs check% \
> +			 cscope TAGS tags help %docs %check \
>  			 include/linux/version.h headers_% \
>  			 kernelrelease kernelversion
>  
> @@ -1024,10 +1024,6 @@ include/linux/version.h: $(srctree)/Makefile FORCE
>  include/generated/utsrelease.h: include/config/kernel.release FORCE
>  	$(call filechk,utsrelease.h)
>  
> -PHONY += headerdep
> -headerdep:
> -	$(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl
> -
>  # ---------------------------------------------------------------------------
>  
>  PHONY += depend dep
> @@ -1273,13 +1269,9 @@ help:
>  	 echo  '                    (default: $(INSTALL_HDR_PATH))'; \
>  	 echo  ''
>  	@echo  'Static analysers'
> -	@echo  '  checkstack      - Generate a list of stack hogs'
> -	@echo  '  namespacecheck  - Name space analysis on compiled kernel'
> -	@echo  '  versioncheck    - Sanity check on version.h usage'
> -	@echo  '  includecheck    - Check for duplicate included header files'
> +	@$(CONFIG_SHELL)$(srctree)/scripts/helpcheck.sh
>  	@echo  '  export_report   - List the usages of all exported symbols'
>  	@echo  '  headers_check   - Sanity check on exported headers'
> -	@echo  '  headerdep       - Detect inclusion cycles in headers'; \
>  	 echo  ''
>  	@echo  'Kernel packaging:'
>  	@$(MAKE) $(build)=$(package-dir) help
> @@ -1427,20 +1419,10 @@ tags TAGS cscope: FORCE
>  	$(call cmd,tags)
>  
>  # Scripts to check various things for consistency
> +# Call a helper script in scripts/ to do the actual job
>  # ---------------------------------------------------------------------------
> -
> -includecheck:
> -	find * $(RCS_FIND_IGNORE) \
> -		-name '*.[hcS]' -type f -print | sort \
> -		| xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
> -
> -versioncheck:
> -	find * $(RCS_FIND_IGNORE) \
> -		-name '*.[hcS]' -type f -print | sort \
> -		| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
> -
> -namespacecheck:
> -	$(PERL) $(srctree)/scripts/namespace.pl
> +%check:
> +	$(Q)$(CONFIG_SHELL)$(srctree)/scripts/$@.sh
>  
>  export_report:
>  	$(PERL) $(srctree)/scripts/export_report.pl
> @@ -1448,20 +1430,7 @@ export_report:
>  endif #ifeq ($(config-targets),1)
>  endif #ifeq ($(mixed-targets),1)
>  
> -PHONY += checkstack kernelrelease kernelversion
> -
> -# UML needs a little special treatment here.  It wants to use the host
> -# toolchain, so needs $(SUBARCH) passed to checkstack.pl.  Everyone
> -# else wants $(ARCH), including people doing cross-builds, which means
> -# that $(SUBARCH) doesn't work here.
> -ifeq ($(ARCH), um)
> -CHECKSTACK_ARCH := $(SUBARCH)
> -else
> -CHECKSTACK_ARCH := $(ARCH)
> -endif
> -checkstack:
> -	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
> -	$(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
> +PHONY += kernelrelease kernelversion
>  
>  kernelrelease:
>  	$(if $(wildcard include/config/kernel.release), $(Q)echo $(KERNELRELEASE), \
> 
> 
> 
> A nice simplification of the top-level Mkefile.
> and an opportunity to document some of the
> magic shell commands used by the various tools.
> 
> If we do this I know the scripts will sum up to a lot more
> lines but doing it distributed is better.
> And some of the lines would be comments that explains what is
> going on.
> 
> An additinal benefit is that we can avoid touching
> the top-level Makefile next time we add a new
> %check target.
> 
> As for cocci this would have the the effect that
> new scipts can be made as drop-in - no changes
> in any files. Just add the files to the
> correct directory.
> 
> 	Sam
> 

Hi,

I am not sure to understand your suggestion.

Should I make this change and integrate it into my patch series
or it is something to do later ?

In doing so, I will have to select the 'mode' in a different way.
I was thinking of renaming my targets in one of the following forms
or using an environment variable:

make cocci-report-check
make report-coccicheck
make coccicheck MODE=report

Do you have any preference ?

-- 
Nicolas Palix
Tel: (+33) 1 44 27 87 25
Tel: (+33) 6 81 07 91 72
Web: http://www.diku.dk/~npalix/

  reply	other threads:[~2010-06-04  9:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10 16:24 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
2010-05-10 16:24 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-05-12  6:42   ` Américo Wang
2010-05-28  7:04     ` Joerg Roedel
2010-06-03  9:50   ` Michal Marek
2010-06-03 10:23   ` Sam Ravnborg
2010-06-04  9:56     ` Nicolas Palix [this message]
2010-06-04 10:38       ` Sam Ravnborg
2010-05-10 16:24 ` [PATCH 2/4] Add scripts/coccinelle/drop_kmalloc_cast.cocci Nicolas Palix
2010-05-10 16:24 ` [PATCH 3/4] Add scripts/coccinelle/kzalloc-simple.cocci Nicolas Palix
2010-06-03  9:51   ` Michal Marek
2010-06-03 10:11     ` Nicolas Palix
2010-05-10 16:24 ` [PATCH 4/4] Add scripts/coccinelle/resource_size.cocci Nicolas Palix
2010-05-10 16:52   ` Pekka Enberg
2010-05-27 11:48     ` Nicolas Palix
2010-05-11  2:14 ` [PATCH 0/4] Add a Coccinelle front-end script Andy Isaacson
2010-05-17  9:31   ` Wolfram Sang
2010-05-28  7:09 ` Joerg Roedel
2010-05-28  7:25   ` Wolfram Sang
2010-05-28  7:31     ` Julia Lawall
2010-05-28  7:39       ` walter harms
2010-05-28  9:15       ` Joerg Roedel
  -- strict thread matches above, loose matches on Subject: below --
2010-04-26 21:11 Nicolas Palix
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-04-26 21:37   ` Joe Perches
2010-04-26 22:20     ` Nicolas Palix
2010-04-26 22:23       ` Randy Dunlap
2010-04-29 17:01         ` Roland Dreier
2010-04-30 21:07           ` Randy Dunlap
2010-04-27 12:40       ` Michal Marek
2010-04-27 13:01       ` Michal Marek
2010-04-27 12:53   ` Wolfram Sang
2010-04-27 20:24   ` Sam Ravnborg
2010-04-27 20:28     ` Sam Ravnborg

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=201006041156.20714.npalix@diku.dk \
    --to=npalix@diku.dk \
    --cc=Gilles.Muller@lip6.fr \
    --cc=akpm@linux-foundation.org \
    --cc=cocci@diku.dk \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=rdreier@cisco.com \
    --cc=rdunlap@xenotime.net \
    --cc=sam@ravnborg.org \
    --cc=w.sang@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).