Re: [PATCH v2 3/3] Makefile: run coccicheck on more source files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 13, 2019 at 01:49:52PM +0200, SZEDER Gábor wrote:
> On Thu, Sep 12, 2019 at 11:40:36AM -0700, Junio C Hamano wrote:
> > Denton Liu <liu.denton@xxxxxxxxx> writes:
> > 
> > > +FIND_C_SOURCES = $(filter %.c,$(shell $(FIND_SOURCE_FILES)))
> > > +COCCI_SOURCES = $(filter-out $(THIRD_PARTY_SOURCES),$(FIND_C_SOURCES))
> > 
> > The former is somewhat misnamed.  FIND_SOURCE_FILES is *not* a list
> > of source files---it is a procedure to list source files to its
> > standard output.  FIND_C_SOUCRES sounds as if it is a similar
> > procedure, which would be implemented much like
> > 
> > 	FIND_C_SOURCES = $(FIND_SOURCE_FILES) | sed -n -e '/\.c$/p'
> > 
> > but that is not what you did and that is not what you want to have.
> > Perhaps call it FOUND_C_SOURCES?
> > 
> > I wonder if we can get rid of FIND_SOURCE_FILES that is a mere
> > procedure and replace its use with a true list of source files.
> > Would it make the result more pleasant to work with?
> > 
> > Perhaps something like the attached patch, (which would come before
> > this entire thing as a clean-up, and removing the need for 2/3)?
> > 
> > I dunno.
> > 
> > Using a procedure whose output is fed to xargs has an advantage that
> > a platform with very short command line limit can still work with
> > many source files, but the way you create and use COCCI_SOURCES in
> > this patch would defeat that advantage anyway,
> 
> COCCI_SOURCES is only used as an input to 'xargs', so that advantage
> is not defeated.

I think it still does matter; the relevant snippet is as follows:

	if ! echo $(COCCI_SOURCES) | xargs $$limit \
		$(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
		>$@+ 2>$@.log; \

which means that a really big COCCI_SOURCES could exceed the limit.

That being said, COCCI_SOURCES should be smaller than the future
SOURCE_FILES variable since we're only taking %.c files (and filtering
out some of them too!).

I dunno, either. I'm mostly in favour of this change since it makes a
lot of sense to keep lists in make variables if possible as opposed to
command invocations. I guess worst case, if someone complains in the
future, we can always change it back.

> 
> > so perhaps we can get
> > away with an approach like this.  Having a list of things in $(MAKE)
> > variable has a longer-term benefit that we could exploit more
> > parallelism if we wanted to, too.
> > 
> >  Makefile | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index f9255344ae..9dddd0e88c 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2584,7 +2584,7 @@ perl/build/man/man3/Git.3pm: perl/Git.pm
> >  	$(QUIET_GEN)mkdir -p $(dir $@) && \
> >  	pod2man $< $@
> >  
> > -FIND_SOURCE_FILES = ( \
> > +SOURCE_FILES = $(patsubst ./%,%,$(shell \
> >  	git ls-files \
> >  		'*.[hcS]' \
> >  		'*.sh' \
> > @@ -2599,19 +2599,19 @@ FIND_SOURCE_FILES = ( \
> >  		-o \( -name 'trash*' -type d -prune \) \
> >  		-o \( -name '*.[hcS]' -type f -print \) \
> >  		-o \( -name '*.sh' -type f -print \) \
> > -	)
> > +	))
> >  
> >  $(ETAGS_TARGET): FORCE
> >  	$(RM) $(ETAGS_TARGET)
> > -	$(FIND_SOURCE_FILES) | xargs etags -a -o $(ETAGS_TARGET)
> > +	etags -a -o $(ETAGS_TARGET) $(SOURCE_FILES)
> >  
> >  tags: FORCE
> >  	$(RM) tags
> > -	$(FIND_SOURCE_FILES) | xargs ctags -a
> > +	ctags -a $(SOURCE_FILES)
> >  
> >  cscope:
> >  	$(RM) cscope*
> > -	$(FIND_SOURCE_FILES) | xargs cscope -b
> > +	cscope -b $(SOURCE_FILES)
> >  
> >  ### Detect prefix changes
> >  TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
> > 
> > 
> > 
> > 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux