diff options
author | Joseph Myers <joseph@codesourcery.com> | 2019-02-13 13:50:13 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2019-02-13 13:50:13 +0000 |
commit | 0538372096e50d9cf0ab8bd413cf7b561a1b85d7 (patch) | |
tree | 56006ae16310643ed582e02b7e4a150a8d05693b /ChangeLog | |
parent | 86140c6223b5d14d773cf3050ffd0d14977c2c2d (diff) | |
download | glibc-0538372096e50d9cf0ab8bd413cf7b561a1b85d7.tar.gz glibc-0538372096e50d9cf0ab8bd413cf7b561a1b85d7.tar.xz glibc-0538372096e50d9cf0ab8bd413cf7b561a1b85d7.zip |
Fix -Wempty-body warnings in glibc.
One group of warnings seen building glibc with -Wextra is -Wempty-body warnings about an 'if' body (or in one case an 'else' body) that is just a semicolon, "warning: suggest braces around empty body in an 'if' statement [-Wempty-body]" - I think the point of the warning being to make it more visible whether an 'if' body is actually present or not. This patch fixes such warnings in glibc. There's one place, with a semicolon at the end of a comment, where this is clearly making the presence of an 'else' body more visible. The other cases involve macro definitions expanding to nothing. While there's no issue there with visibility at the call sites, I think it's still cleaner to have a macro that expands to something nonempty appropriate for the context - so do {} while (0) if it's only intended to be usable as a statement, or ((void) 0) where the macro definition is an alternative to a call to a function returning void, so this patch makes those changes. Tested for x86_64. * catgets/gencat.c (normalize_line): Use braces around empty 'else' body. * include/stap-probe.h [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE0): Use do {} while (0) for do-nothing definition. [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE1): Likewise. [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE2): Likewise. [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE3): Likewise. [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE4): Likewise. * libio/libio.h (_IO_funlockfile): Use ((void) 0) for do-nothing definition.
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 4279eeedb3..f8210cdb41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2019-02-13 Joseph Myers <joseph@codesourcery.com> + * catgets/gencat.c (normalize_line): Use braces around empty + 'else' body. + * include/stap-probe.h [!USE_STAP_PROBE && !__ASSEMBLER__] + (STAP_PROBE0): Use do {} while (0) for do-nothing definition. + [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE1): Likewise. + [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE2): Likewise. + [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE3): Likewise. + [!USE_STAP_PROBE && !__ASSEMBLER__] (STAP_PROBE4): Likewise. + * libio/libio.h (_IO_funlockfile): Use ((void) 0) for do-nothing + definition. + * support/test-container.c (recursive_remove): Use FAIL_EXIT1 if execlp returns. |