Change in openvpn[master]: Enable a subset of -Wextra
A message that is not in the archive (sent off-list or not yet received): gerrit.1758282060000.I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
to review the following change.
Change subject: Enable a subset of -Wextra
......................................................................
Enable a subset of -Wextra
- Includes fixes for
- -Wimplicit-fallthrough=2
(=3 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.
---
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, 17 insertions(+), 7 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1202/1
CMakeLists.txt +5 -0
@@ -114,6 +114,11 @@ 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 -Wimplicit-fallthrough=2 -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) + 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 ()
configure.ac +5 -0
@@ -1398,6 +1398,11 @@ 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 -Wimplicit-fallthrough=2 -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) +if test "${WIN32}" = "yes"; then + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"
src/openvpn/misc.c +1 -1
@@ -742,7 +742,7 @@ {return false; } - +/* Intentional [[fallthrough]]; */ case 2 :/* after the '=', replace non-printable or shell meta with '_' */ if (!isprint (c) ||isspace (c) || c =='$' || c =='(' || c =='`' )
src/openvpn/tun.c +2 -2
@@ -84,10 +84,10 @@#ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static GUID GUID_DEVINTERFACE_NET = { +static const GUID GUID_DEVINTERFACE_NET = {0xcac88484 ,0x7515 ,0x4c03 , {0x82 ,0xe6 ,0x71 ,0xa8 ,0x7a ,0xba ,0xc3 ,0x61 } };
src/tapctl/tap.c +2 -2
@@ -40,11 +40,11 @@#endif -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] = +static const WCHAR szAdapterRegKeyPathTemplate[] =L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection" ;#define ADAPTER_REGKEY_PATH_MAX \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -164,7 +164,7 @@ init_tas_auth(int key_direction) {struct tls_auth_standalone tas = {0 }; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.tls_wrap.mode =TLS_WRAP_AUTH ;
@@ -591,7 +591,7 @@enum first_packet_verdict verdict; tas.tls_wrap.mode =TLS_WRAP_NONE ; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.workbuf =alloc_buf (1600 );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email )
Change subject: Enable a subset of -Wextra
......................................................................
Patch Set 2:
This change is ready for review.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 22 Sep 2025 14:51:15 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
to look at the new patch set (#3).
Change subject: Enable a subset of -Wextra
......................................................................
Enable a subset of -Wextra
- Includes fixes for
- -Wimplicit-fallthrough=2
(=3 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.
---
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(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1202/3
CMakeLists.txt +8 -1
@@ -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-unused-parameter) + # clang doesn't have the different levels but also doesn't include it in -Wextra + check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) + 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 ()
configure.ac +7 -0
@@ -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 -Wno-unused-parameter]) +# clang doesn't have the different levels but also doesn't include it in -Wextra +ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) +if test "${WIN32}" = "yes"; then + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"
src/openvpn/misc.c +1 -1
@@ -733,7 +733,7 @@ {return false; } - +/* Intentional [[fallthrough]]; */ case 2 :/* after the '=', replace non-printable or shell meta with '_' */ if (!isprint (c) ||isspace (c) || c =='$' || c =='(' || c =='`' )
src/openvpn/tun.c +2 -2
@@ -84,10 +84,10 @@#ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static GUID GUID_DEVINTERFACE_NET = { +static const GUID GUID_DEVINTERFACE_NET = {0xcac88484 ,0x7515 ,0x4c03 , {0x82 ,0xe6 ,0x71 ,0xa8 ,0x7a ,0xba ,0xc3 ,0x61 } };
src/tapctl/tap.c +2 -2
@@ -40,11 +40,11 @@#endif -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] = +static const WCHAR szAdapterRegKeyPathTemplate[] =L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection" ;#define ADAPTER_REGKEY_PATH_MAX \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -164,7 +164,7 @@ init_tas_auth(int key_direction) {struct tls_auth_standalone tas = {0 }; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.tls_wrap.mode =TLS_WRAP_AUTH ;
@@ -591,7 +591,7 @@enum first_packet_verdict verdict; tas.tls_wrap.mode =TLS_WRAP_NONE ; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.workbuf =alloc_buf (1600 );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email )
Change subject: Enable a subset of -Wextra
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 23 Sep 2025 14:08:40 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v3 1/1 Enable a subset of -Wextra
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
- Includes fixes for
- -Wimplicit-fallthrough=2
(=3 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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202
---
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/+/1202
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
CMakeLists.txt +8 -1
@@ -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-unused-parameter) + # clang doesn't have the different levels but also doesn't include it in -Wextra + check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) + 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 ()
configure.ac +7 -0
@@ -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 -Wno-unused-parameter]) +# clang doesn't have the different levels but also doesn't include it in -Wextra +ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) +if test "${WIN32}" = "yes"; then + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"
src/openvpn/misc.c +1 -1
@@ -733,7 +733,7 @@ {return false; } - +/* Intentional [[fallthrough]]; */ case 2 :/* after the '=', replace non-printable or shell meta with '_' */ if (!isprint (c) ||isspace (c) || c =='$' || c =='(' || c =='`' )
src/openvpn/tun.c +2 -2
@@ -84,10 +84,10 @@#ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static GUID GUID_DEVINTERFACE_NET = { +static const GUID GUID_DEVINTERFACE_NET = {0xcac88484 ,0x7515 ,0x4c03 , {0x82 ,0xe6 ,0x71 ,0xa8 ,0x7a ,0xba ,0xc3 ,0x61 } };
src/tapctl/tap.c +2 -2
@@ -40,11 +40,11 @@#endif -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] = +static const WCHAR szAdapterRegKeyPathTemplate[] =L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection" ;#define ADAPTER_REGKEY_PATH_MAX \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -164,7 +164,7 @@ init_tas_auth(int key_direction) {struct tls_auth_standalone tas = {0 }; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.tls_wrap.mode =TLS_WRAP_AUTH ;
@@ -591,7 +591,7 @@enum first_packet_verdict verdict; tas.tls_wrap.mode =TLS_WRAP_NONE ; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.workbuf =alloc_buf (1600 );
[Openvpn-devel] [PATCH applied] Re: Enable a subset of -Wextra
Stared at the changes, some are "huh, wat?" (like the const <-> static reordering, but so what), one [[fallthrough]] was obviously forgotten in commit fed37d0, and the struct assignment gets easier to read this way, so double benefit :-) - wrt the CMakeFile change, GHA is fine with it, and I don't have to understand it.
Your patch has been applied to the master branch.
commit 45eb7e1807060a927ff805b0d01fbb8cfbb772c8 (master)
Author: Frank Lichtenheld Date: Tue Sep 23 16:08:48 2025 +0200
Enable a subset of -Wextra
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237558/
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#4) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Enable a subset of -Wextra
......................................................................
Enable a subset of -Wextra
- Includes fixes for
- -Wimplicit-fallthrough=2
(=3 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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237558/
---
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(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1202/4
CMakeLists.txt +8 -1
@@ -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-unused-parameter) + # clang doesn't have the different levels but also doesn't include it in -Wextra + check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) + 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 ()
configure.ac +7 -0
@@ -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 -Wno-unused-parameter]) +# clang doesn't have the different levels but also doesn't include it in -Wextra +ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) +if test "${WIN32}" = "yes"; then + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"
src/openvpn/misc.c +1 -1
@@ -733,7 +733,7 @@ {return false; } - +/* Intentional [[fallthrough]]; */ case 2 :/* after the '=', replace non-printable or shell meta with '_' */ if (!isprint (c) ||isspace (c) || c =='$' || c =='(' || c =='`' )
src/openvpn/tun.c +2 -2
@@ -84,10 +84,10 @@#ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static GUID GUID_DEVINTERFACE_NET = { +static const GUID GUID_DEVINTERFACE_NET = {0xcac88484 ,0x7515 ,0x4c03 , {0x82 ,0xe6 ,0x71 ,0xa8 ,0x7a ,0xba ,0xc3 ,0x61 } };
src/tapctl/tap.c +2 -2
@@ -40,11 +40,11 @@#endif -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] = +static const WCHAR szAdapterRegKeyPathTemplate[] =L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection" ;#define ADAPTER_REGKEY_PATH_MAX \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -164,7 +164,7 @@ init_tas_auth(int key_direction) {struct tls_auth_standalone tas = {0 }; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.tls_wrap.mode =TLS_WRAP_AUTH ;
@@ -591,7 +591,7 @@enum first_packet_verdict verdict; tas.tls_wrap.mode =TLS_WRAP_NONE ; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.workbuf =alloc_buf (1600 );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email )
Change subject: Enable a subset of -Wextra
......................................................................
Enable a subset of -Wextra
- Includes fixes for
- -Wimplicit-fallthrough=2
(=3 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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237558/
---
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(-)
CMakeLists.txt +8 -1
@@ -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-unused-parameter) + # clang doesn't have the different levels but also doesn't include it in -Wextra + check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) + 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 ()
configure.ac +7 -0
@@ -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 -Wno-unused-parameter]) +# clang doesn't have the different levels but also doesn't include it in -Wextra +ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) +if test "${WIN32}" = "yes"; then + # Not sure how to deal with GetProcAddress + ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) +fi if test "${enable_pedantic}" = "yes"; then enable_strict="yes"
src/openvpn/misc.c +1 -1
@@ -733,7 +733,7 @@ {return false; } - +/* Intentional [[fallthrough]]; */ case 2 :/* after the '=', replace non-printable or shell meta with '_' */ if (!isprint (c) ||isspace (c) || c =='$' || c =='(' || c =='`' )
src/openvpn/tun.c +2 -2
@@ -84,10 +84,10 @@#ifdef _WIN32 -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static GUID GUID_DEVINTERFACE_NET = { +static const GUID GUID_DEVINTERFACE_NET = {0xcac88484 ,0x7515 ,0x4c03 , {0x82 ,0xe6 ,0x71 ,0xa8 ,0x7a ,0xba ,0xc3 ,0x61 } };
src/tapctl/tap.c +2 -2
@@ -40,11 +40,11 @@#endif -const static GUID GUID_DEVCLASS_NET = { +static const GUID GUID_DEVCLASS_NET = {0x4d36e972L ,0xe325 ,0x11ce , {0xbf ,0xc1 ,0x08 ,0x00 ,0x2b ,0xe1 ,0x03 ,0x18 } }; -const static WCHAR szAdapterRegKeyPathTemplate[] = +static const WCHAR szAdapterRegKeyPathTemplate[] =L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection" ;#define ADAPTER_REGKEY_PATH_MAX \ (_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -164,7 +164,7 @@ init_tas_auth(int key_direction) {struct tls_auth_standalone tas = {0 }; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.tls_wrap.mode =TLS_WRAP_AUTH ;
@@ -591,7 +591,7 @@enum first_packet_verdict verdict; tas.tls_wrap.mode =TLS_WRAP_NONE ; -struct frame frame = { { .headroom =200 , .payload_size =1400 },0 }; +struct frame frame = { .buf = { .headroom =200 , .payload_size =1400 },0 }; tas.frame = frame; tas.workbuf =alloc_buf (1600 );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1202?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Gerrit-Change-Number: 1202
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged