From: "flichtenheld (Code Review)"
Date: Tue, 14 Oct 2025 11:33:57 +0000
In-Reply-To:
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net
Message-ID: <68ef46d81d13168da75ad05ca7ed03ce3a5851ab-EmailReplacePatchSet-HTML@...2715...>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="YXvLEltEr2c="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: Enable -Wtype-limits
by default (via -Wextra)
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos
Cc: openvpn-devel
--YXvLEltEr2c=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1207?usp=3Demail
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review-1 by plaisthos
Change subject: Enable -Wtype-limits by default (via -Wextra)
......................................................................
Enable -Wtype-limits by default (via -Wextra)
Removes a few smaller instances:
- Fix return type check for socket() on Windows/Unixy
- Ignore a few instances related to WSAWaitForMultipleEvents.
The compiler says the check is currently useless, but
we follow the API documentation.
Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Signed-off-by: Frank Lichtenheld
---
M CMakeLists.txt
M configure.ac
M src/openvpn/event.c
M src/openvpn/socket.c
4 files changed, 16 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1207/4
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b773dcb..4b42413 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,7 +114,7 @@
check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes)
check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition)
add_compile_options(-Wconversion -Wno-sign-conversion)
- add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-un=
used-parameter)
+ add_compile_options(-Wextra -Wno-sign-compare -Wno-unused-parameter)
# clang doesn't have the different levels but also doesn't include it =
in -Wextra
check_and_add_compiler_flag(-Wimplicit-fallthrough=3D2 GCCImplicitFall=
through)
if (WIN32)
diff --git a/configure.ac b/configure.ac
index 8f3c01d..44c7b65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1399,7 +1399,7 @@
ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wconversion -Wno-sign-conversion])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
-ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -W=
no-unused-parameter])
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-paramet=
er])
# clang doesn't have the different levels but also doesn't include it in -=
Wextra
ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=3D2])
if test "${WIN32}" =3D "yes"; then
diff --git a/src/openvpn/event.c b/src/openvpn/event.c
index ca84d19..ca2d0c1 100644
--- a/src/openvpn/event.c
+++ b/src/openvpn/event.c
@@ -410,6 +410,13 @@
}
#endif
+ /* WSA_WAIT_EVENT_0 =3D=3D 0 but the API documentation is written in a=
way
+ that doesn't guarantee that. So we make useless checks. */
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
/*
* First poll our event list with 0 timeout
*/
@@ -474,6 +481,9 @@
return -1;
}
}
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
static struct event_set *
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index f71d891..23b6439 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -577,7 +577,8 @@
ASSERT(addrinfo);
ASSERT(addrinfo->ai_socktype =3D=3D SOCK_STREAM);
- if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinf=
o->ai_protocol)) < 0)
+ if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinf=
o->ai_protocol))
+ =3D=3D SOCKET_UNDEFINED)
{
msg(M_ERR, "Cannot create TCP socket");
}
@@ -608,7 +609,8 @@
ASSERT(addrinfo);
ASSERT(addrinfo->ai_socktype =3D=3D SOCK_DGRAM);
- if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinf=
o->ai_protocol)) < 0)
+ if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai_socktype, addrinf=
o->ai_protocol))
+ =3D=3D SOCKET_UNDEFINED)
{
msg(M_ERR, "UDP: Cannot create UDP/UDP6 socket");
}
--=20
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1207?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
Gerrit-Attention: flichtenheld
--YXvLEltEr2c=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is cur=
rently required from: flichtenheld, plaisthos.
flichtenheld uploaded patch set #4 to this change.
<=
p>View C=
hange
The following approvals got outdated and were removed:
Code-Review-1 by plaisthos
Enable -Wtype-limits by default=
(via -Wextra)
Removes a few smaller instances:
- Fix return typ=
e check for socket() on Windows/Unixy
- Ignore a few instances related =
to WSAWaitForMultipleEvents.
The compiler says the check is currently=
useless, but
we follow the API documentation.
Change-Id: Iaab=
ddb6f81cd94863291b193aae9d384a8f9d871
Signed-off-by: Frank Lichtenheld &=
lt;frank@...2641...>
---
M CMakeLists.txt
M configure.ac
M s=
rc/openvpn/event.c
M src/openvpn/socket.c
4 files changed, 16 inserti=
ons(+), 4 deletions(-)
git pull ssh://gerrit.ope=
nvpn.net:29418/openvpn refs/changes/07/1207/4
diff --git a/CMakeLis=
ts.txt b/CMakeLists.txt
index b773dcb..4b42413 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt=
@@ -114,7 +114,7 @@
check_and_add_compiler_f=
lag(-Wstrict-prototypes StrictPrototypes)
check_and_ad=
d_compiler_flag(-Wold-style-definition OldStyleDefinition)
=
add_compile_options(-Wconversion -Wno-sign-conversion)
- add_compile_options(-Wextra -Wno-=
sign-compare -Wno-type-limits -Wno-unused-parameter)
+ add_compile_options(-Wextra -Wno-sign=
-compare -Wno-unused-parameter)
# clang doesn't ha=
ve the different levels but also doesn't include it in -Wextra check_and_add_compiler_flag(-Wimplicit-fallthrough=3D2 GCCImpl=
icitFallthrough)
if (WIN32)
diff --git=
a/configure.ac b/configure.ac
index 8f3c01d..44c7b65 10064=
4
--- a/configure.ac
+++ b/configure.ac
@@ -1399,7 +1399,7 @@
ACL_CHECK_ADD_COMPILE_F=
LAGS([-Wold-style-definition])
ACL_CHECK_ADD_COMPILE_FLAGS=
([-Wconversion -Wno-sign-conversion])
ACL_CHECK_ADD_COMPIL=
E_FLAGS([-Wall])
-ACL_C=
HECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unu=
sed-parameter])
+ACL_=
CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-unused-parameter])<=
/span>
# clang doesn't have the different levels but also doe=
sn't include it in -Wextra
ACL_CHECK_ADD_COMPILE_FLAGS=
([-Wimplicit-fallthrough=3D2])
if test "${WIN32}"=
; =3D "yes"; then
diff --git a/src/openvpn/event.=
c b/src/openvpn/event.c
index ca84d19..ca2d0c1 100644
--- a/src/openvpn/event.c
+++ b/src/openvpn/even=
t.c
@@ -410,6 +410,13 @@
}
<=
span> #endif
+ /* WSA_WAIT_EVENT_0 =3D=3D 0 but the API documentation is wr=
itten in a way
+ =
that doesn't guarantee that. So we make useless checks. */
=
+#if defined(__GNUC__)+#pragma GCC diagnostic push<=
/span>
+#pragma GCC diagnost=
ic ignored "-Wtype-limits"
+#endif
+
/*
* First poll our event l=
ist with 0 timeout
*/
@@ -474,6 +481,=
9 @@
return -1;
}
}
+=
#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
stati=
c struct event_set *
diff --git a/src/openvpn/socket.c b/sr=
c/openvpn/socket.c
index f71d891..23b6439 100644
=
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c=
@@ -577,7 +577,8 @@
ASSERT(addrinfo);=
ASSERT(addrinfo->ai_socktype =3D=3D SOCK_STREAM);<=
/span>
- =
if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai_socktype, addrin=
fo->ai_protocol)) < 0)
+ if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai_soc=
ktype, addrinfo->ai_protocol))
+ =3D=3D SOCKET_UNDEFINED)
{
msg(M_ERR, "Cannot create TCP socket");
}
@@ -608,7 +609,8 @@
=
ASSERT(addrinfo);
ASSERT(addrinfo->ai_socktype =3D=
=3D SOCK_DGRAM);
- if ((sd =3D socket(addrinfo->ai_family, addrinfo->ai=
_socktype, addrinfo->ai_protocol)) < 0)
+ if ((sd =3D socket(addrinfo->ai_family, ad=
drinfo->ai_socktype, addrinfo->ai_protocol))
+ =3D=3D SOCKET_UNDEFINED)
<=
span> {
msg(M_ERR, "UDP: Cannot create UD=
P/UDP6 socket");
}
To view, visit change 1207. To unsubscribe, or for help writing mail filt=
ers, visit setti=
ngs.
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iaabddb6f81cd94863291b193aae=
9d384a8f9d871
Gerrit-Change-Number: 1207
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...=
41...>
=
--YXvLEltEr2c=--