[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new stdbool test provokes warning
From: |
Jim Meyering |
Subject: |
new stdbool test provokes warning |
Date: |
Sun, 19 Dec 2010 23:18:26 +0100 |
Hi Bruno,
The new stdbool test causes this warning/failure in coreutils:
cc1: warnings being treated as errors
test-stdbool.c: In function 'main':
test-stdbool.c:98:9: error: unused variable 'e1' [-Wunused-variable]
make[8]: *** [test-stdbool.o] Error 1
Here's the code:
main ()
{
#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */
# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */
/* A cast from a variable's address to bool is valid in expressions. */
bool e1 = &s;
# endif
#endif
One way to avoid those is to add an
(void) e1;
statement after each (there's another, above),
but that might not be enough for some compilers.
To go all the way, we could use ignore_value.
Do you have a preference -- or another approach?
- new stdbool test provokes warning,
Jim Meyering <=