- 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.
Change-Id: I9ce664d073a4e6a6d433e9e6f986a5086dae8aa1
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1202
Message-Id: <20250923140854.21766-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237558/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
| ... | ... |
@@ -114,7 +114,14 @@ else () |
| 114 | 114 |
check_and_add_compiler_flag(-Wstrict-prototypes StrictPrototypes) |
| 115 | 115 |
check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition) |
| 116 | 116 |
# We are not ready for this |
| 117 |
- #add_compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare) |
|
| 117 |
+ #add_compile_options(-Wconversion -Wno-sign-conversion) |
|
| 118 |
+ add_compile_options(-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter) |
|
| 119 |
+ # clang doesn't have the different levels but also doesn't include it in -Wextra |
|
| 120 |
+ check_and_add_compiler_flag(-Wimplicit-fallthrough=2 GCCImplicitFallthrough) |
|
| 121 |
+ if (WIN32) |
|
| 122 |
+ # Not sure how to deal with GetProcAddress |
|
| 123 |
+ add_compile_options(-Wno-cast-function-type) |
|
| 124 |
+ endif () |
|
| 118 | 125 |
if (USE_WERROR) |
| 119 | 126 |
add_compile_options(-Werror) |
| 120 | 127 |
endif () |
| ... | ... |
@@ -1398,6 +1398,13 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation]) |
| 1398 | 1398 |
ACL_CHECK_ADD_COMPILE_FLAGS([-Wstrict-prototypes]) |
| 1399 | 1399 |
ACL_CHECK_ADD_COMPILE_FLAGS([-Wold-style-definition]) |
| 1400 | 1400 |
ACL_CHECK_ADD_COMPILE_FLAGS([-Wall]) |
| 1401 |
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wextra -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter]) |
|
| 1402 |
+# clang doesn't have the different levels but also doesn't include it in -Wextra |
|
| 1403 |
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wimplicit-fallthrough=2]) |
|
| 1404 |
+if test "${WIN32}" = "yes"; then
|
|
| 1405 |
+ # Not sure how to deal with GetProcAddress |
|
| 1406 |
+ ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) |
|
| 1407 |
+fi |
|
| 1401 | 1408 |
|
| 1402 | 1409 |
if test "${enable_pedantic}" = "yes"; then
|
| 1403 | 1410 |
enable_strict="yes" |
| ... | ... |
@@ -733,7 +733,7 @@ validate_peer_info_line(char *line) |
| 733 | 733 |
{
|
| 734 | 734 |
return false; |
| 735 | 735 |
} |
| 736 |
- |
|
| 736 |
+ /* Intentional [[fallthrough]]; */ |
|
| 737 | 737 |
case 2: |
| 738 | 738 |
/* after the '=', replace non-printable or shell meta with '_' */ |
| 739 | 739 |
if (!isprint(c) || isspace(c) || c == '$' || c == '(' || c == '`')
|
| ... | ... |
@@ -84,10 +84,10 @@ print_tun_backend_driver(enum tun_driver_type driver) |
| 84 | 84 |
|
| 85 | 85 |
#ifdef _WIN32 |
| 86 | 86 |
|
| 87 |
-const static GUID GUID_DEVCLASS_NET = {
|
|
| 87 |
+static const GUID GUID_DEVCLASS_NET = {
|
|
| 88 | 88 |
0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 }
|
| 89 | 89 |
}; |
| 90 |
-const static GUID GUID_DEVINTERFACE_NET = {
|
|
| 90 |
+static const GUID GUID_DEVINTERFACE_NET = {
|
|
| 91 | 91 |
0xcac88484, 0x7515, 0x4c03, { 0x82, 0xe6, 0x71, 0xa8, 0x7a, 0xba, 0xc3, 0x61 }
|
| 92 | 92 |
}; |
| 93 | 93 |
|
| ... | ... |
@@ -40,11 +40,11 @@ |
| 40 | 40 |
#endif |
| 41 | 41 |
|
| 42 | 42 |
|
| 43 |
-const static GUID GUID_DEVCLASS_NET = {
|
|
| 43 |
+static const GUID GUID_DEVCLASS_NET = {
|
|
| 44 | 44 |
0x4d36e972L, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 }
|
| 45 | 45 |
}; |
| 46 | 46 |
|
| 47 |
-const static WCHAR szAdapterRegKeyPathTemplate[] = |
|
| 47 |
+static const WCHAR szAdapterRegKeyPathTemplate[] = |
|
| 48 | 48 |
L"SYSTEM\\CurrentControlSet\\Control\\Network\\%ls\\%ls\\Connection"; |
| 49 | 49 |
#define ADAPTER_REGKEY_PATH_MAX \ |
| 50 | 50 |
(_countof(L"SYSTEM\\CurrentControlSet\\Control\\Network\\") - 1 + 38 + _countof(L"\\") - 1 \ |
| ... | ... |
@@ -164,7 +164,7 @@ struct tls_auth_standalone |
| 164 | 164 |
init_tas_auth(int key_direction) |
| 165 | 165 |
{
|
| 166 | 166 |
struct tls_auth_standalone tas = { 0 };
|
| 167 |
- struct frame frame = { { .headroom = 200, .payload_size = 1400 }, 0 };
|
|
| 167 |
+ struct frame frame = { .buf = { .headroom = 200, .payload_size = 1400 }, 0 };
|
|
| 168 | 168 |
tas.frame = frame; |
| 169 | 169 |
|
| 170 | 170 |
tas.tls_wrap.mode = TLS_WRAP_AUTH; |
| ... | ... |
@@ -591,7 +591,7 @@ test_generate_reset_packet_plain(void **ut_state) |
| 591 | 591 |
enum first_packet_verdict verdict; |
| 592 | 592 |
|
| 593 | 593 |
tas.tls_wrap.mode = TLS_WRAP_NONE; |
| 594 |
- struct frame frame = { { .headroom = 200, .payload_size = 1400 }, 0 };
|
|
| 594 |
+ struct frame frame = { .buf = { .headroom = 200, .payload_size = 1400 }, 0 };
|
|
| 595 | 595 |
tas.frame = frame; |
| 596 | 596 |
tas.workbuf = alloc_buf(1600); |
| 597 | 597 |
|