This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA v2] Make it easy to make --disable-werror the default for both binutils and gdb
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: <gdb-patches at sourceware dot org>, <binutils at sourceware dot org>, Alan Modra <amodra at gmail dot com>, Hans-Peter Nilsson <hp at bitrange dot com>, Tom Tromey <tromey at redhat dot com>
- Date: Wed, 4 Jun 2014 13:43:19 +0100
- Subject: Re: [RFA v2] Make it easy to make --disable-werror the default for both binutils and gdb
- Authentication-results: sourceware.org; auth=none
- References: <1401811030-22706-1-git-send-email-brobecker at adacore dot com>
On Tue, 3 Jun 2014, Joel Brobecker wrote:
> This is V2 of the patch series. Hopefully, I incorporated all comments
> made so far. The changes compared to the previous version are:
>
> . Use "-a" instead of "&&" in the test expression; (H-P)
I think Hans-Peter's suggestion was the other way round, its "&&" that is
portable while "-a" is likely not to work with non-GNU `test' or with
plain Bourne shells (where it is a builtin). This is what the autoconf
manual has to say about it in its portability section:
`test'
The `test' program is the way to perform many file and string
tests. It is often invoked by the alternate name `[', but using
that name in Autoconf code is asking for trouble since it is an M4
quote character.
The `-a', `-o', `(', and `)' operands are not portable and should
be avoided. Thus, portable uses of `test' should never have more
than four arguments, and scripts should use shell constructs like
`&&' and `||' instead. If you combine `&&' and `||' in the same
statement, keep in mind that they have equal precedence, so it is
often better to parenthesize even when this is redundant. For
example:
# Not portable:
test "X$a" = "X$b" -a \
'(' "X$c" != "X$d" -o "X$e" = "X$f" ')'
# Portable:
test "X$a" = "X$b" &&
{ test "X$c" != "X$d" || test "X$e" = "X$f"; }
Maciej