This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Remove superfluous /dev/null on grep line


On Wed, Apr 06, 2016 at 10:12:18AM +0100, Jonathan Wakely wrote:
> >As it is a make variable, can't make be used to test this?
> >So perhaps
> >	chmod +w $@.tmp
> >ifneq ($(port_specific_symbol_files),)
> >	  if grep '^# Appended to version file.' \
> >	       $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
> >	    cat $(port_specific_symbol_files) >> $@.tmp; \
> >	  else \
> >	    sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \
> >	    sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \
> >	    cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \
> >	    rm tmp.top tmp.bottom; \
> >	  fi;
> >endif
> >?  Though, I think the initial and trailing whitespace is removed during
> >expansion (or already parsing of the vars), so even the
> >test "x$(port_specific_symbol_files)" != x
> >check should work right.
> 
> OK, I have no objection to the original patch then.

To correct myself, only leading whitespace is removed, trailing is not,
but when we do care about vars containing only whitespace, that means
removing everything.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]