Skip to contentSkip to conversation

configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)

PATCH In review Thomas Huth 2 participants 2 messages Apr 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)

Without the -Wno-typedef-redefinition option, clang complains if a typedef gets redefined in gnu99 mode (since this is officially a C11 feature). This used to also happen with older versions of GCC, but since we've bumped our minimum GCC version to 4.8, all versions of GCC that we support do not seem to issue this warning in gnu99 mode anymore. So this has become a common problem for people who only test their code with GCC - they do not notice the issue until they submit their patches and suddenly patchew or a maintainer complains.

Now that we do not urgently need to keep the code clean from typedef redefintions anymore with recent versions of GCC, we can ease the situation with clang, too, and simply shut these warnings off for good.

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 2cc365be51..8e15dc9870 100755
@@ -1917,7 +1917,7 @@ gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_
 gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-Wendif-labels -Wno-shift-negative-value $gcc_flags"
 gcc_flags="-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags"
-gcc_flags="-Wno-string-plus-int $gcc_flags"
+gcc_flags="-Wno-string-plus-int -Wno-typedef-redefinition $gcc_flags"
 # Note that we do not add -Werror to gcc_flags here, because that would
 # enable it for all configure tests. If a configure test failed due
 # to -Werror this would just silently disable some features,
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Thomas Huth

Without the -Wno-typedef-redefinition option, clang complains if a typedef gets redefined in gnu99 mode (since this is officially a C11 feature). This used to also happen with older versions of GCC, but since we've bumped our minimum GCC version to 4.8, all versions of GCC that we support do not seem to issue this warning in gnu99 mode anymore. So this has become a common problem for people who only test their code with GCC - they do not notice the issue until they submit their patches and suddenly patchew or a maintainer complains.

Quoted 8 lines

Now that we do not urgently need to keep the code clean from typedef redefintions anymore with recent versions of GCC, we can ease the situation with clang, too, and simply shut these warnings off for good.

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

r~