coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] [PATCH] tests: do not assume compiler knows -Wxxx flags


From: Jim Meyering
Subject: Re: [coreutils] [PATCH] tests: do not assume compiler knows -Wxxx flags
Date: Wed, 22 Dec 2010 11:16:03 +0100

Paul Eggert wrote:
> * gnulib-tests/Makefile.am (test_xvasprintf_CFLAGS):
> (test_lock_CFLAGS, test_tls_CFLAGS): Do not append GCC-specific
> flags like -Wno-format-security unless the GCC-specific flag
> -Werror is also specified.  This avoids a "make check" failure on
> Solaris when using Sun C 5.8.
> ---
...
> -test_xvasprintf_CFLAGS = $(AM_CFLAGS) -Wno-format-security
> +test_xvasprintf_CFLAGS = $(AM_CFLAGS) \
> +  `test X$(WERROR_CFLAGS) = X || echo ' -Wno-format-security'`

Thanks for the fix.
Here's a minor adjustment.
While I've never defined WERROR_CFLAGS to anything
other than the empty string or -Werror, it's easy to
accommodate, and using a positive test like  test -n '...' && ...
is more readable to me than the negative one test X... = X || ...

>From 51f60a62372581fc7260f4c0eae52f06c39201ec Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 22 Dec 2010 11:10:23 +0100
Subject: [PATCH] tests: adjust preceding change to handle general WERROR_CFLAGS 
values

* gnulib-tests/Makefile.am (test_xvasprintf_CFLAGS):
(test_lock_CFLAGS, test_tls_CFLAGS): Avoid a syntax error when
$(WERROR_CFLAGS) expands to more than one token.
---
 gnulib-tests/Makefile.am |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnulib-tests/Makefile.am b/gnulib-tests/Makefile.am
index 311baf9..edaa0a7 100644
--- a/gnulib-tests/Makefile.am
+++ b/gnulib-tests/Makefile.am
@@ -9,12 +9,12 @@ AM_CFLAGS = $(GNULIB_TEST_WARN_CFLAGS) $(WERROR_CFLAGS)
 # test-xvasprintf.c:100: error: format not a string literal and no \
 #   format arguments [-Wformat-security]
 test_xvasprintf_CFLAGS = $(AM_CFLAGS) \
-  `test X$(WERROR_CFLAGS) = X || echo ' -Wno-format-security'`
+  `test -n '$(WERROR_CFLAGS)' && echo ' -Wno-format-security'`

 # test-lock.c: In function 'lock_mutator_thread':
 # test-lock.c:148: error: cast from function call of type 'pthread_t' to \
 #   non-matching type 'void *' [-Wbad-function-cast]
 test_lock_CFLAGS = $(AM_CFLAGS) \
-  `test X$(WERROR_CFLAGS) = X || echo ' -Wno-bad-function-cast'`
+  `test -n '$(WERROR_CFLAGS)' && echo ' -Wno-bad-function-cast'`
 test_tls_CFLAGS = $(AM_CFLAGS) \
-  `test X$(WERROR_CFLAGS) = X || echo ' -Wno-bad-function-cast'`
+  `test -n '$(WERROR_CFLAGS)' && echo ' -Wno-bad-function-cast'`
--
1.7.3.3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]