mirror of
https://github.com/OpenVPN/openvpn.git
synced 2024-09-20 03:52:28 +02:00
Drop gnu89/c89 support, switch to c99
Previously, we would use the compiler's default C version, which defaults to gnu89 for GCC < 5, gnu11 for GCC > 5, and c11 for clang, but might even differ per distro. One of the reasons to accept the gnu89 default of GCC < 4.9, was that MSVC didn't support c99. But in MSVC 2015, MS finanally fixed that. Having to support c89 in the codebase occasionally forces us to write less readable code, for example by forcing all declaration to be at the starting of a block (which includes 'for loop initial declarations'). Let's be clear about what standard we obey, and stop punishing ourselves with c89/gnu89. Let's switch the master branch to c99. v2: don't try to detect pedantic mode based on __STRICT_ANSI__, since that will be defined when using -std=c99. v3: only set -std=c99 if there is no -std= already present in CFLAGS Signed-off-by: Steffan Karger <steffan@karger.me> Acked-by: David Sommerseth <davids@openvpn.net> Message-Id: 1472760870-11769-1-git-send-email-steffan@karger.me URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00194.html Signed-off-by: David Sommerseth <davids@openvpn.net>
This commit is contained in:
parent
cbc3c5a983
commit
058f0efdec
@ -1125,10 +1125,16 @@ if test "${enable_pkcs11}" = "yes"; then
|
||||
)
|
||||
fi
|
||||
|
||||
# Set -std=c99 unless user already specified a -std=
|
||||
case "${CFLAGS}" in
|
||||
*-std=*) ;;
|
||||
*) CFLAGS="${CFLAGS} -std=c99" ;;
|
||||
esac
|
||||
|
||||
if test "${enable_pedantic}" = "yes"; then
|
||||
enable_strict="yes"
|
||||
CFLAGS="${CFLAGS} -pedantic"
|
||||
test "${WIN32}" != "yes" && CFLAGS="${CFLAGS} -std=c99"
|
||||
AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode])
|
||||
fi
|
||||
if test "${enable_strict}" = "yes"; then
|
||||
CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
|
||||
|
@ -384,16 +384,13 @@
|
||||
* Pedantic mode is meant to accomplish lint-style program checking,
|
||||
* not to build a working executable.
|
||||
*/
|
||||
#ifdef __STRICT_ANSI__
|
||||
# define PEDANTIC 1
|
||||
#ifdef PEDANTIC
|
||||
# undef HAVE_CPP_VARARG_MACRO_GCC
|
||||
# undef HAVE_CPP_VARARG_MACRO_ISO
|
||||
# undef EMPTY_ARRAY_SIZE
|
||||
# define EMPTY_ARRAY_SIZE 1
|
||||
# undef inline
|
||||
# define inline
|
||||
#else
|
||||
# define PEDANTIC 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user