mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
Fix elf/loadtest.c build with GCC 8.
Building the testsuite with current GCC mainline fails with: loadtest.c: In function 'main': loadtest.c:76:3: error: macro expands to multiple statements [-Werror=multistatement-macros] for (map = MAPS; map != NULL; map = map->l_next) \ ^ loadtest.c:165:2: note: in expansion of macro 'OUT' OUT; ^~~ loadtest.c:164:7: note: some parts of macro expansion are not guarded by this 'if' clause if (debug) ^~ This seems like a genuine bug, although fairly harmless; it means the fflush call in the OUT macro is unconditional instead of being inside the conditional as presumably intended. This patch makes this macro use do { } while (0) to avoid the problem. Tested for x86_64 (testsuite), and with build-many-glibcs.py for aarch64-linux-gnu with GCC mainline. * elf/loadtest.c (OUT): Define using do { } while (0).
This commit is contained in:
parent
e4043b84c4
commit
ac782f9e9a
@ -1,5 +1,7 @@
|
|||||||
2017-06-27 Joseph Myers <joseph@codesourcery.com>
|
2017-06-27 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* elf/loadtest.c (OUT): Define using do { } while (0).
|
||||||
|
|
||||||
* time/strftime_l.c (DO_NUMBER): Define using do { } while (0).
|
* time/strftime_l.c (DO_NUMBER): Define using do { } while (0).
|
||||||
(DO_NUMBER_SPACEPAD): Likewise.
|
(DO_NUMBER_SPACEPAD): Likewise.
|
||||||
|
|
||||||
|
@ -72,12 +72,16 @@ static const struct
|
|||||||
|
|
||||||
#define MAPS ((struct link_map *) _r_debug.r_map)
|
#define MAPS ((struct link_map *) _r_debug.r_map)
|
||||||
|
|
||||||
#define OUT \
|
#define OUT \
|
||||||
for (map = MAPS; map != NULL; map = map->l_next) \
|
do \
|
||||||
if (map->l_type == lt_loaded) \
|
{ \
|
||||||
printf ("name = \"%s\", direct_opencount = %d\n", \
|
for (map = MAPS; map != NULL; map = map->l_next) \
|
||||||
map->l_name, (int) map->l_direct_opencount); \
|
if (map->l_type == lt_loaded) \
|
||||||
fflush (stdout)
|
printf ("name = \"%s\", direct_opencount = %d\n", \
|
||||||
|
map->l_name, (int) map->l_direct_opencount); \
|
||||||
|
fflush (stdout); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user