[Openvpn-devel,v1] error: Remove our implementation of static_assert

Message ID 20260115092552.25011-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] error: Remove our implementation of static_assert | expand

Commit Message

Gert Doering Jan. 15, 2026, 9:25 a.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

It is C11, so it should be present in all our
compilers.

Change-Id: I9cb14b9f44409ec5c78044ddb216a2b4dced0f9b
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1471
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1471
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering Jan. 15, 2026, 10:06 a.m. UTC | #1
Easy enough, and BB agrees that it still compiles fine on all formally
supported platforms (= we did not test Haiku or AIX, but even those have
gcc and should be fine).

URL links to sf.net today, because mail-archive.org is not working right.

Your patch has been applied to the master branch.

commit 6768ef1dab5cb6c1dbc210c20cf92820a64dace3
Author: Frank Lichtenheld
Date:   Thu Jan 15 10:25:47 2026 +0100

     error: Remove our implementation of static_assert

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1471
     Message-Id: <20260115092552.25011-1-gert@greenie.muc.de>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59283672/
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/error.h b/src/openvpn/error.h
index 44572b4..1198994 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -245,14 +245,6 @@ 
 #endif
     ;
 
-/* Poor-man's static_assert() for when not supplied by assert.h, taken from
- * Linux's sys/cdefs.h under GPLv2 */
-#ifndef static_assert
-#define static_assert(expr, diagnostic)            \
-    extern int (*__OpenVPN_static_assert_function( \
-        void))[!!sizeof(struct { int __error_if_negative : (expr) ? 2 : -1; })]
-#endif
-
 /* Inline functions */
 
 static inline bool