Skip to content

Commit 2f29bd0

Browse files
committed
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.
1 parent 16e2359 commit 2f29bd0

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ AC_PROG_CXX
8989
LT_INIT
9090
AM_SANITY_CHECK
9191

92+
# Verify that the selected compiler actually supports C11
93+
AS_IF([test "x$ac_cv_prog_cc_c11" = "xno"], [
94+
CFLAGS="${CFLAGS} -std=gnu99 -Wno-c11-extensions"
95+
])
96+
9297
# Checks for library functions
9398
#AC_CHECK_FUNCS([strlcpy strlcat])
9499
OCFLAGS=$CFLAGS

htp/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ c_sources = bstr.c bstr_builder.c htp_base64.c htp_config.c htp_connection.c htp
1818
library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME)
1919
library_include_HEADERS = $(h_sources)
2020

21-
AM_CFLAGS = -I$(top_srcdir) -I$(top_builddir)/htp -D_GNU_SOURCE -g -Wall -Wextra -std=gnu99 -pedantic \
21+
AM_CFLAGS = -I$(top_srcdir) -I$(top_builddir)/htp -D_GNU_SOURCE -g -Wall -Wextra -pedantic \
2222
-Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith \
2323
-Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter
2424

htp/lzma/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ h_sources_private = LzFind.h LzHash.h Compiler.h Precomp.h
55

66
c_sources = LzFind.c LzmaDec.c
77

8-
AM_CFLAGS = -I$(top_srcdir) -D_GNU_SOURCE -g -Wall -Wextra -std=gnu99 -pedantic \
8+
AM_CFLAGS = -I$(top_srcdir) -D_GNU_SOURCE -g -Wall -Wextra -pedantic \
99
-Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith \
1010
-Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter
1111

test/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
LDADD = $(top_builddir)/htp/libhtp.la -lz @LIBICONV@
22

3-
AM_CFLAGS = -D_GNU_SOURCE -g -Wall -Wextra -std=gnu99 -pedantic \
3+
AM_CFLAGS = -D_GNU_SOURCE -g -Wall -Wextra -pedantic \
44
-Wextra -Wno-missing-field-initializers -Wshadow -Wpointer-arith \
55
-Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter
66

0 commit comments

Comments
 (0)