Use -Warith-conversion only with gcc 10 and later
This commit is contained in:
parent
c6a872ed61
commit
a15dd2aae5
17
configure.ac
17
configure.ac
@ -94,6 +94,23 @@ if test "$ap_cv_cc_pie" = "yes"; then
|
||||
enable_pie=yes
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether $CC accepts -Warith-conversion flag], [ap_cv_cc_warith], [
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
CFLAGS="$CFLAGS -Warith-conversion"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
|
||||
[ap_cv_cc_warith=yes],
|
||||
[ap_cv_cc_warith=no],
|
||||
[ap_cv_cc_warith=yes]
|
||||
)
|
||||
CFLAGS=$save_CFLAGS
|
||||
])
|
||||
if test "$ap_cv_cc_warith" = "yes"; then
|
||||
CFLAGS="$CFLAGS -Warith-conversion"
|
||||
enable_warith_conversion=yes
|
||||
fi
|
||||
|
||||
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.6], [enable_tests=yes], [enable_tests=no])
|
||||
AM_CONDITIONAL([COND_WANT_TESTS], [test "$enable_tests" = yes])
|
||||
|
||||
|
@ -41,4 +41,4 @@ AM_CFLAGS=-Wall -Wextra -Werror \
|
||||
-D_FORTIFY_SOURCE=2 \
|
||||
-fstack-protector-strong -fstack-clash-protection \
|
||||
-Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code \
|
||||
-Wpedantic -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-security -Wnull-dereference -Wstack-protector -Wtrampolines -Walloca -Wvla -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wcast-qual -Wstringop-overflow=4 -Wconversion -Warith-conversion -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wshadow -Wstrict-overflow=4 -Wundef -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wstack-usage=1000000 -Wcast-align=strict
|
||||
-Wpedantic -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-security -Wnull-dereference -Wstack-protector -Wtrampolines -Walloca -Wvla -Warray-bounds=2 -Wimplicit-fallthrough=3 -Wtraditional-conversion -Wshift-overflow=2 -Wcast-qual -Wstringop-overflow=4 -Wconversion -Wlogical-op -Wduplicated-cond -Wduplicated-branches -Wformat-signedness -Wshadow -Wstrict-overflow=4 -Wundef -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wstack-usage=1000000 -Wcast-align=strict
|
||||
|
Loading…
Reference in New Issue
Block a user