From 2f29bd059371a33a5df0bb6660fca37e8edd00c7 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 20 May 2026 11:19:28 +0200 Subject: [PATCH] autotools: drop gnu99 as default If c11 is not available, use gnu99 and suppress c11-extensions warnings. To address: htp_util.c:623:32: warning: '_Generic' is a C11 extension [-Wc11-extensions] 623 | unsigned char *colon = memchr(data, ':', len); | ^ /usr/include/string.h:122:3: note: expanded from macro 'memchr' 122 | __glibc_const_generic (S, const void *, memchr (S, C, N)) | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ htp_util.c:799:32: warning: '_Generic' is a C11 extension [-Wc11-extensions] 799 | unsigned char *m = memchr(data + start, '@', pos - start); | ^ /usr/include/string.h:122:3: note: expanded from macro 'memchr' 122 | __glibc_const_generic (S, const void *, memchr (S, C, N)) | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ htp_util.c:810:21: warning: '_Generic' is a C11 extension [-Wc11-extensions] 810 | m = memchr(credentials_start, ':', credentials_len); | ^ /usr/include/string.h:122:3: note: expanded from macro 'memchr' 122 | __glibc_const_generic (S, const void *, memchr (S, C, N)) | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ htp_util.c:832:21: warning: '_Generic' is a C11 extension [-Wc11-extensions] 832 | m = memchr(hostname_start, ']', hostname_len); | ^ /usr/include/string.h:122:3: note: expanded from macro 'memchr' 122 | __glibc_const_generic (S, const void *, memchr (S, C, N)) | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ htp_util.c:846:25: warning: '_Generic' is a C11 extension [-Wc11-extensions] 846 | m = memchr(hostname_start, ':', hostname_len); | ^ /usr/include/string.h:122:3: note: expanded from macro 'memchr' 122 | __glibc_const_generic (S, const void *, memchr (S, C, N)) | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ htp_util.c:856:21: warning: '_Generic' is a C11 extension [-Wc11-extensions] 856 | m = memchr(hostname_start, ':', hostname_len); | ^ /usr/include/string.h:122:3: note: expanded from macro 'memchr' 122 | __glibc_const_generic (S, const void *, memchr (S, C, N)) | ^ /usr/include/x86_64-linux-gnu/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic' 838 | _Generic (0 ? (PTR) : (void *) 1, \ | ^ 6 warnings generated. --- configure.ac | 5 +++++ htp/Makefile.am | 2 +- htp/lzma/Makefile.am | 2 +- test/Makefile.am | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index c28441b1..c321335c 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,11 @@ AC_PROG_CXX LT_INIT AM_SANITY_CHECK +# Verify that the selected compiler actually supports C11 +AS_IF([test "x$ac_cv_prog_cc_c11" = "xno"], [ + CFLAGS="${CFLAGS} -std=gnu99 -Wno-c11-extensions" + ]) + # Checks for library functions #AC_CHECK_FUNCS([strlcpy strlcat]) OCFLAGS=$CFLAGS diff --git a/htp/Makefile.am b/htp/Makefile.am index a3e82456..188f012c 100644 --- a/htp/Makefile.am +++ b/htp/Makefile.am @@ -18,7 +18,7 @@ c_sources = bstr.c bstr_builder.c htp_base64.c htp_config.c htp_connection.c htp library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME) library_include_HEADERS = $(h_sources) -AM_CFLAGS = -I$(top_srcdir) -I$(top_builddir)/htp -D_GNU_SOURCE -g -Wall -Wextra -std=gnu99 -pedantic \ +AM_CFLAGS = -I$(top_srcdir) -I$(top_builddir)/htp -D_GNU_SOURCE -g -Wall -Wextra -pedantic \ -Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith \ -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter diff --git a/htp/lzma/Makefile.am b/htp/lzma/Makefile.am index 5fa3ec50..438f9f76 100644 --- a/htp/lzma/Makefile.am +++ b/htp/lzma/Makefile.am @@ -5,7 +5,7 @@ h_sources_private = LzFind.h LzHash.h Compiler.h Precomp.h c_sources = LzFind.c LzmaDec.c -AM_CFLAGS = -I$(top_srcdir) -D_GNU_SOURCE -g -Wall -Wextra -std=gnu99 -pedantic \ +AM_CFLAGS = -I$(top_srcdir) -D_GNU_SOURCE -g -Wall -Wextra -pedantic \ -Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith \ -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter diff --git a/test/Makefile.am b/test/Makefile.am index e2ecf77f..c703f3e6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,6 @@ LDADD = $(top_builddir)/htp/libhtp.la -lz @LIBICONV@ -AM_CFLAGS = -D_GNU_SOURCE -g -Wall -Wextra -std=gnu99 -pedantic \ +AM_CFLAGS = -D_GNU_SOURCE -g -Wall -Wextra -pedantic \ -Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith \ -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter