From: Michael Tremer Date: Thu, 6 Mar 2025 17:45:38 +0000 (+0000) Subject: configure: Enable more compiler warnings X-Git-Tag: 0.9.18~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eac3f16bc6655383414cd1f94aa05423f58db2f2;p=location%2Flibloc.git configure: Enable more compiler warnings Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 8084f89..e5b4fc5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,11 +21,13 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -I${top_srcdir}/src -AM_CFLAGS = ${my_CFLAGS} \ +AM_CFLAGS = \ + $(OUR_CFLAGS) \ -ffunction-sections \ -fdata-sections -AM_LDFLAGS = ${my_LDFLAGS} +AM_LDFLAGS = \ + $(OUR_LDFLAGS) # leaving a space here to work around automake's conditionals ifeq ($(OS),Darwin) @@ -218,7 +220,10 @@ src_python__location_la_SOURCES = \ src_python__location_la_CFLAGS = \ $(AM_CFLAGS) \ - $(PYTHON_CFLAGS) + $(PYTHON_CFLAGS) \ + -Wno-cast-function-type \ + -Wno-redundant-decls \ + -Wno-strict-aliasing src_python__location_la_LDFLAGS = \ $(AM_LDFLAGS) \ diff --git a/configure.ac b/configure.ac index 550b942..cb49bb8 100644 --- a/configure.ac +++ b/configure.ac @@ -125,33 +125,65 @@ AC_CHECK_FUNCS([ \ qsort \ ]) -my_CFLAGS="\ --Wall \ --Wchar-subscripts \ --Wformat-security \ --Wmissing-declarations \ --Wmissing-prototypes \ --Wnested-externs \ --Wpointer-arith \ --Wshadow \ --Wsign-compare \ --Wstrict-prototypes \ --Wtype-limits \ -" -AC_SUBST([my_CFLAGS]) -AC_SUBST([my_LDFLAGS]) +CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ + -std=gnu17 \ + -Wall \ + -Wextra \ + -Warray-bounds=2 \ + -Wdate-time \ + -Wendif-labels \ + -Werror=format=2 \ + -Werror=format-signedness \ + -Werror=implicit-function-declaration \ + -Werror=implicit-int \ + -Werror=incompatible-pointer-types \ + -Werror=int-conversion \ + -Werror=missing-declarations \ + -Werror=missing-prototypes \ + -Werror=overflow \ + -Werror=override-init \ + -Werror=return-type \ + -Werror=shift-count-overflow \ + -Werror=shift-overflow=2 \ + -Werror=strict-flex-arrays \ + -Werror=undef \ + -Wfloat-equal \ + -Wimplicit-fallthrough=5 \ + -Winit-self \ + -Wlogical-op \ + -Wmissing-include-dirs \ + -Wmissing-noreturn \ + -Wnested-externs \ + -Wold-style-definition \ + -Wpointer-arith \ + -Wredundant-decls \ + -Wshadow \ + -Wstrict-aliasing=2 \ + -Wstrict-prototypes \ + -Wsuggest-attribute=noreturn \ + -Wunused-function \ + -Wwrite-strings \ + -Wzero-length-bounds \ + -Wno-unused-parameter \ + -Wno-missing-field-initializers \ + -fdiagnostics-show-option \ + -fno-common \ +]) + +# Enable -fno-semantic-interposition (if available) +CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-fno-semantic-interposition]) +CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [-fno-semantic-interposition]) # Enable -fanalyzer if requested AC_ARG_ENABLE([analyzer], AS_HELP_STRING([--enable-analyzer], [enable static analyzer (-fanalyzer) @<:@default=disabled@:>@]), [], [enable_analyzer=no]) AS_IF([test "x$enable_analyzer" = "xyes"], - CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fanalyzer]) + CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-fanalyzer]) ) -# Enable -fno-semantic-interposition (if available) -CC_CHECK_FLAGS_APPEND([my_CFLAGS], [CFLAGS], [-fno-semantic-interposition]) -CC_CHECK_FLAGS_APPEND([my_LDFLAGS], [LDFLAGS], [-fno-semantic-interposition]) +AC_SUBST([OUR_CFLAGS], $with_cflags) +AC_SUBST([OUR_LDFLAGS], $with_ldflags) # ------------------------------------------------------------------------------