]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Remove flexible array member autoconf check
authorArne Schwabe <arne@rfc2549.org>
Sun, 28 Mar 2021 14:20:37 +0000 (16:20 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 28 Mar 2021 14:32:57 +0000 (16:32 +0200)
This is configure macro that tries out how to declare a variable array
at the end of struct. This has been standardised in C99, so there is
no more need for non C99 magic. See also this stackoverflow discussion:

https://stackoverflow.com/questions/14643406/whats-the-need-of-array-with-z
ero-elements

Patch V2: Also remove AX_EMPTY_ARRAY from configure.ac

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Steffan Karger <steffan.karger@foxcrypto.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210328142038.8826-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21882.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
config-msvc.h
configure.ac
m4/ax_emptyarray.m4 [deleted file]
src/openvpn/circ_list.h
src/openvpn/syshead.h

index e430ca96fd8053274294d3396b1ee96058c57c89..0260927ce117db0f2b00f54d3a4c4f4d065ba067 100644 (file)
 #define inline __inline
 #endif
 
-#define EMPTY_ARRAY_SIZE 0
 #define TARGET_WIN32 1
 #define TARGET_ALIAS "Windows-MSVC"
 
index 428bebeda4a4465525bf89c15952b82f29e2cc12..c17266a0a5c40bae4a3d64ff87e7655b7532754c 100644 (file)
@@ -421,7 +421,6 @@ AC_TYPE_SIGNAL
 AX_CPP_VARARG_MACRO_ISO
 AX_CPP_VARARG_MACRO_GCC
 AX_TYPE_SOCKLEN_T
-AX_EMPTY_ARRAY
 AC_CHECK_SIZEOF([unsigned int])
 AC_CHECK_SIZEOF([unsigned long])
 AC_CHECK_HEADERS([ \
diff --git a/m4/ax_emptyarray.m4 b/m4/ax_emptyarray.m4
deleted file mode 100644 (file)
index c6781c1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-dnl @synopsis AX_EMPTY_ARRAY
-dnl
-dnl Define EMPTY_ARRAY_SIZE to be either "0"
-dnl or "" depending on which syntax the compiler
-dnl prefers for empty arrays in structs.
-dnl
-dnl @version
-dnl @author James Yonan <jim@yonan.net>
-AC_DEFUN([AX_EMPTY_ARRAY], [
-       AS_VAR_PUSHDEF([VAR],[ax_cv_c_empty_array])dnl
-       AC_CACHE_CHECK(
-               [for C compiler empty array size],
-               [VAR],
-               [AC_COMPILE_IFELSE(
-                       [AC_LANG_PROGRAM(
-                               ,
-                               [[
-struct { int foo; int bar[0]; } mystruct;
-                               ]]
-                       )],
-                       [VAR=0],
-                       [AC_COMPILE_IFELSE(
-                               [AC_LANG_PROGRAM(
-                                       ,
-                                       [[
-struct { int foo; int bar[]; } mystruct;
-                                       ]]
-                               )],
-                               [VAR=],
-                               [AC_MSG_ERROR([C compiler is unable to creaty empty arrays])]
-                       )]
-               )]
-       )dnl
-       AC_DEFINE_UNQUOTED(
-               [EMPTY_ARRAY_SIZE],
-               [$VAR],
-               [Dimension to use for empty array declaration]
-       )dnl
-       AS_VAR_POPDEF([VAR])dnl
-])
index 23b42d2ab8f2607213f3a749572a897930affdf4..ba9115eabcf3edb241f919b672f28d77319db40e 100644 (file)
@@ -34,7 +34,7 @@
         int x_size; \
         int x_cap; \
         int x_sizeof; \
-        type x_list[EMPTY_ARRAY_SIZE]; \
+        type x_list[]; \
     }
 
 #define CIRC_LIST_PUSH(obj, item) \
index 5ee9bf1e84651485001fec8eec845cc22894f27a..cf9714593b76399feb997bb662e14ca74d8494ef 100644 (file)
@@ -392,8 +392,6 @@ typedef int MIB_TCP_STATE;
 #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
 #endif