[Openvpn-devel,v2] configure: Switch to C11 by default

Message ID 20240710160306.190351-1-frank@lichtenheld.com
State Accepted
Headers show
Series [Openvpn-devel,v2] configure: Switch to C11 by default | expand

Commit Message

Frank Lichtenheld July 10, 2024, 4:03 p.m. UTC
Mostly so we can use anonymous structs without jumping through
hoops or relying on unofficial support.

Change-Id: I72934e747d1ad68a7e3675afbeb1b63df7941186
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
---

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/+/673
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>

Comments

Gert Doering July 10, 2024, 7:32 p.m. UTC | #1
Hi,

On Wed, Jul 10, 2024 at 06:03:06PM +0200, Frank Lichtenheld wrote:
> Mostly so we can use anonymous structs without jumping through
> hoops or relying on unofficial support.
> 
> Change-Id: I72934e747d1ad68a7e3675afbeb1b63df7941186
> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
> Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
> ---
> 
> This change was reviewed on Gerrit and approved by at least one
> developer. I request to merge it to master.

This breaks all OpenBSD 6.8 builds.  Are you intentionally ignoring
this ("this OS is out of support, we'll discontinue this buildbot"?  If
yes, we might want to point out that this change has fallout on older
"build environments" - not sure what is problematic here, C compiler or
system headers, or libc...

gert
Frank Lichtenheld July 11, 2024, 9:39 a.m. UTC | #2
On Wed, Jul 10, 2024 at 09:32:39PM +0200, Gert Doering wrote:
> Hi,
> 
> On Wed, Jul 10, 2024 at 06:03:06PM +0200, Frank Lichtenheld wrote:
> > Mostly so we can use anonymous structs without jumping through
> > hoops or relying on unofficial support.
> > 
> > Change-Id: I72934e747d1ad68a7e3675afbeb1b63df7941186
> > Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
> > Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
> > ---
> > 
> > This change was reviewed on Gerrit and approved by at least one
> > developer. I request to merge it to master.
> 
> This breaks all OpenBSD 6.8 builds.  Are you intentionally ignoring
> this ("this OS is out of support, we'll discontinue this buildbot"?  If
> yes, we might want to point out that this change has fallout on older
> "build environments" - not sure what is problematic here, C compiler or
> system headers, or libc...

Yes, ignoring that intentionally. I plan to disable OpenBSD 6.8 builds for master
instead.

Basically the intent of this patch is to approve
https://gerrit.openvpn.net/c/openvpn/+/588 (Remove check for anonymous unions
from configure and cmake config) but improve it by officially switching to C11
(which implies support for anonymous unions).

We can certainly extend the messaging.

Regards,
Gert Doering July 17, 2024, 8:04 p.m. UTC | #3
As discussed before, this breaks OpenBSD 6.8 builds (and, generally,
other systems with very old compilers).  Not sure the benefit of getting
rid of a few hoops for anonymous unions is worth it, but then, it's not
like people on those systems couldn't just update...

Your patch has been applied to the master branch.

commit 37b696a207548df88fe65aa130fe6d522e7ce920 (master)
Author: Frank Lichtenheld
Date:   Wed Jul 10 18:03:06 2024 +0200

     configure: Switch to C11 by default

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Message-Id: <20240710160306.190351-1-frank@lichtenheld.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28916.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 096837d..ad620fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,7 +119,7 @@ 
 set(OPENVPN_VERSION_PATCH ${PRODUCT_VERSION_PATCH})
 set(OPENVPN_VERSION_RESOURCE ${PRODUCT_VERSION_RESOURCE})
 
-set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD 11)
 
 # Set the various defines for config.h.cmake.in
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
diff --git a/configure.ac b/configure.ac
index 1f03f90..dcc46e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -421,10 +421,10 @@ 
 AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py])
 AM_CONDITIONAL([HAVE_PYDOCUTILS], [test "${RST2MAN}" -a "${RST2HTML}"])
 
-# Set -std=c99 unless user already specified a -std=
+# Set -std=c11 unless user already specified a -std=
 case "${CFLAGS}" in
   *-std=*) ;;
-  *)       CFLAGS="${CFLAGS} -std=c99" ;;
+  *)       CFLAGS="${CFLAGS} -std=c11" ;;
 esac
 
 #