From a3c5065689073b5e43bc11c765049dfd1a04671c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 9 Dec 2021 12:39:30 +0000 Subject: [PATCH] configure: Replace CFLAGS All flags that are default or a decision by the operating system have been removed and we only enable a bunch of warnings that will help us to write better code. Signed-off-by: Michael Tremer --- configure.ac | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 7649c9d5..8de01532 100644 --- a/configure.ac +++ b/configure.ac @@ -100,19 +100,18 @@ m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-conf AC_PROG_CC_STDC CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ - -pipe \ -Wall \ - -Wextra \ - -Wno-inline \ - -Wundef \ - "-Wformat=2 -Wformat-security -Wformat-nonliteral" \ - -Wno-unused-parameter \ - -Wno-unused-result \ - -fno-strict-aliasing \ - -ffunction-sections \ - -fdata-sections \ - -fstack-protector-all \ - --param=ssp-buffer-size=4]) + -Wchar-subscripts \ + -Wformat-security \ + -Wmissing-declarations \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wpointer-arith \ + -Wshadow \ + -Wsign-compare \ + -Wstrict-prototypes \ + -Wtype-limits \ +]) # Enable -fanalyzer if requested AC_ARG_ENABLE([analyzer], @@ -122,18 +121,6 @@ AS_IF([test "x$enable_analyzer" = "xyes"], CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-fanalyzer]) ) -AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*], - [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\ - -Wp,-D_FORTIFY_SOURCE=2])], - [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])]) - -CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\ - -Wl,--as-needed \ - -Wl,--no-undefined \ - -Wl,--gc-sections \ - -Wl,-z,relro \ - -Wl,-z,now]) - # 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]) -- 2.39.2