From: "cron2 (Code Review)" Date: Tue, 23 Sep 2025 14:35:27 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <32c0b3a71b5781eea99888b398e36994e55ad379-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="8+47M6nApBw="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Enable a subset of -Wextra List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --8+47M6nApBw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/12= 02?usp=3Demail ) Change subject: Enable a subset of -Wextra ...................................................................... Enable a subset of -Wextra - Includes fixes for - -Wimplicit-fallthrough=3D2 (=3D3 is default but requires replacing all fallthrough comments) - -Wmissing-field-initializers - -Wold-style-declaration - All other warnings that would need fixes are disabled for now. Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202 Message-Id: <20250923140854.21766-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59237558/ Signed-off-by: Gert Doering --- M CMakeLists.txt M configure.ac M src/openvpn/misc.c M src/openvpn/tun.c M src/tapctl/tap.c M tests/unit_tests/openvpn/test_pkt.c 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f027b01..fdc0162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,14 @@ check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) # We are not ready for this - #add_compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare) + #add_compile_options(-Wconversion -Wno-sign-conversion) + add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-un= used-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) + # Not sure how to deal with GetProcAddress + add_compile_options(-Wno-cast-function-type) + endif () if (USE_WERROR) add_compile_options(-Werror) endif () diff --git a/configure.ac b/configure.ac index 0fc21ee..c2feeea 100644 --- a/configure.ac +++ b/configure.ac @@ -1398,6 +1398,13 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) +ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -W= no-unused-parameter]) +# 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 + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" =3D "yes"; then enable_strict=3D"yes" diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index e0b5da1..d3d316d 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -733,7 +733,7 @@ { return false; } - + /* Intentional [[fallthrough]]; */ case 2: /* after the '=3D', replace non-printable or shell meta wi= th '_' */ if (!isprint(c) || isspace(c) || c =3D=3D '$' || c =3D=3D = '(' || c =3D=3D '`') diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 9618301..c213c4b 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -84,10 +84,10 @@ #ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET =3D { +static const GUID GUID_DEVCLASS_NET =3D { 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x0= 3, 0x18 } }; -const static GUID GUID_DEVINTERFACE_NET =3D { +static const GUID GUID_DEVINTERFACE_NET =3D { 0xcac88484, 0x7515, 0x4c03, { 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3= , 0x61 } }; diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c index b633e77..9731602 100644 --- a/src/tapctl/tap.c +++ b/src/tapctl/tap.c @@ -40,11 +40,11 @@ #endif -const static GUID GUID_DEVCLASS_NET =3D { +static const GUID GUID_DEVCLASS_NET =3D { 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x0= 3, 0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] =3D +static const WCHAR szAdapterRegKeyPathTemplate[] =3D L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection"; #define ADAPTER_REGKEY_PATH_MAX = \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 += _countof(L"\\") - 1 \ diff --git a/tests/unit_tests/openvpn/test_pkt.c b/tests/unit_tests/openvpn= /test_pkt.c index b5211cd..1423d46 100644 --- a/tests/unit_tests/openvpn/test_pkt.c +++ b/tests/unit_tests/openvpn/test_pkt.c @@ -164,7 +164,7 @@ init_tas_auth(int key_direction) { struct tls_auth_standalone tas =3D { 0 }; - struct frame frame =3D { { .headroom =3D 200, .payload_size =3D 1400 }= , 0 }; + struct frame frame =3D { .buf =3D { .headroom =3D 200, .payload_size = =3D 1400 }, 0 }; tas.frame =3D frame; tas.tls_wrap.mode =3D TLS_WRAP_AUTH; @@ -591,7 +591,7 @@ enum first_packet_verdict verdict; tas.tls_wrap.mode =3D TLS_WRAP_NONE; - struct frame frame =3D { { .headroom =3D 200, .payload_size =3D 1400 }= , 0 }; + struct frame frame =3D { .buf =3D { .headroom =3D 200, .payload_size = =3D 1400 }, 0 }; tas.frame =3D frame; tas.workbuf =3D alloc_buf(1600); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1 Gerrit-Change-Number: 1202 Gerrit-PatchSet: 4 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --8+47M6nApBw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Enable a subset of -Wextra

- Includes = fixes for
- -Wimplicit-fallthrough=3D2
(=3D3 is default but req= uires replacing all
fallthrough comments)
- -Wmissing-field-in= itializers
- -Wold-style-declaration
- All other warnings that woul= d need fixes are
disabled for now.

Change-Id: I9ce664d073a4e6a6= d433e9e6f986a5086dae8aa1
Signed-off-by: Frank Lichtenheld <frank@...1665...= 641...>
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL:= https://gerrit.openvpn.net/c/openvpn/+/1202
Message-Id: <20250923140= 854.21766-1-gert@...1296...>
URL: https://sourceforge.net/p/openvpn/m= ailman/message/59237558/
Signed-off-by: Gert Doering <gert@...1296...= >
---
M CMakeLists.txt
M configure.ac
M src/openvpn/misc.cM src/openvpn/tun.c
M src/tapctl/tap.c
M tests/unit_tests/openvpn/t= est_pkt.c
6 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f027b= 01..fdc0162 100644
--- a/CMakeLists.txt
+++= b/CMakeLists.txt
@@ -114,7 +114,14 @@
= check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) check_and_add_compiler_flag(-Wold-style-definition OldStyleDef= inition)
# We are not ready for this
- #add_compile_options(-Wconversion -= Wno-sign-conversion -Wsign-compare)
+ #add_compile_options(-Wconversion -Wno-sign-conversion)=
+ add_compile_opt= ions(-Wextra -Wno-sign-compare -Wno-type-limits -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 GCCImplicitFallthrough)
+ if (WIN32)
+ # Not sure how to deal with GetPr= ocAddress
+ ad= d_compile_options(-Wno-cast-function-type)
+ endif ()
if (USE_WERROR)
add_compile_options(-Werror)
en= dif ()
diff --git a/configure.ac b/configure.ac
<= span>index 0fc21ee..c2feeea 100644

--- a/configure.ac
+++ b/configure.ac
@@ -1398,6 +1398,13 @@=
ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition])

= ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wn= o-type-limits -Wno-unused-parameter])
+# clang doesn't have the different levels but also do= esn't include it in -Wextra
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=3D2])
+if test "${WIN32}&qu= ot; =3D "yes"; then
+ # Not sure how to deal with GetProcAddress
+ ACL_CHECK_ADD_COMPILE_FLAGS([-Wno= -cast-function-type])

+fi

if test "${enable_pedantic}&qu= ot; =3D "yes"; then
enable_strict=3D"yes&q= uot;
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index e0b5da1..d3d316d 100644
--- a/src/open= vpn/misc.c
+++ b/src/openvpn/misc.c
@@ -733= ,7 +733,7 @@
{
= return false;
}
-
+ /* Intentional [[fallthrough]]; */=
case 2:
/* after th= e '=3D', replace non-printable or shell meta with '_' */
if (!isprint(c) || isspace(c) || c =3D=3D &#= 39;$' || c =3D=3D '(' || c =3D=3D '`')
= diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 96= 18301..c213c4b 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c

@@ -84,10 +84,10 @@

#ifdef _WIN32

-const static GUID GUID_DEVCLASS_NET =3D {<= /span>
+static const GUID GU= ID_DEVCLASS_NET =3D {
0x4d36e972L, 0xe325, 0x11ce, { 0= xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 }
};<= br>-const static GUID GUID_DEVINT= ERFACE_NET =3D {
+sta= tic const GUID GUID_DEVINTERFACE_NET =3D {
0xcac88484,= 0x7515, 0x4c03, { 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3, 0x61 }<= br> };

diff --git a/src/tapctl/tap.= c b/src/tapctl/tap.c
index b633e77..9731602 100644--- a/src/tapctl/tap.c
+++ b/src/tapctl/tap.c
@@ -40,11 +40,11 @@
#endif


-const = static GUID GUID_DEVCLASS_NET =3D {
+static const GUID GUID_DEVCLASS_NET =3D {
= 0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03= , 0x18 }
};

-const static WCHAR szAdapterRegKeyPathTemplate[] = =3D
+static const WCH= AR szAdapterRegKeyPathTemplate[] =3D
L"SYSTEM\\Cu= rrentControlSet\\Control\\Network\\%ls\\%ls\\Connection";
#define ADAPTER_REGKEY_PATH_MAX = \

(_countof(L"SYSTEM\\Cu= rrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\&qu= ot;) - 1 \
diff --git a/tests/unit_tests/openvpn/test_pkt.c= b/tests/unit_tests/openvpn/test_pkt.c
index b5211cd..1423d= 46 100644
--- a/tests/unit_tests/openvpn/test_pkt.c<= br>+++ b/tests/unit_tests/openvpn/test_pkt.c
@@ -164,= 7 +164,7 @@
init_tas_auth(int key_direction)
{

struct tls_auth_standalone tas =3D { 0 };=
- struct frame frame =3D {= { .headroom =3D 200, .payload_size =3D 1400 }, 0 };
+ struct frame frame =3D { .buf =3D { .= headroom =3D 200, .payload_size =3D 1400 }, 0 };
tas.f= rame =3D frame;

tas.tls_wrap.mode = =3D TLS_WRAP_AUTH;
@@ -591,7 +591,7 @@
= enum first_packet_verdict verdict;

= tas.tls_wrap.mode =3D TLS_WRAP_NONE;
- struct frame frame =3D { { .headroom =3D 200, .payload_s= ize =3D 1400 }, 0 };
= + struct frame frame =3D { .buf =3D { .headroom =3D 200, .payload_size = =3D 1400 }, 0 };
tas.frame =3D frame;
= tas.workbuf =3D alloc_buf(1600);


To view, visit change 1202. To unsubscribe, or for help writin= g mail filters, visit settin= gs.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f98= 6a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--8+47M6nApBw=--