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: Toplevel Makefile.tpl cleanup 2/n part two


On Mar  4, 2003, Nathanael Nerode <neroden at twcny dot rr dot com> wrote:

>>> All the invocations of 'true' are, in fact, useless.
>> 
>> Nope.  Some make&shell combinations will fail if an `if' test fails
>> and there's no `else true' clause.

> You're saying that 
> blah:
> 	if false ; then : fi ; true ;

> will actually *fail* in certain make/shell combinations?

That's my understanding, yes.  The `false' exit status will be
regarded as the exit status of the if, and `true' may never get a
chance to run.

> Sure, the exit value of the if statement can be 1 or whatever, but in 
> a ;-separated list, doesn't the exit value of the later statement 
> override it?

Nope.  set -e stops at the first error.  Some makes run shell commands
with set -e enabled.

> Is there really a shell *that* broken?

IMO, the only brokenness is to propagate the exit status of the if
test to the if command in case an else clause is missing.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer


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