From: "cron2 (Code Review)" Date: Fri, 9 May 2025 10:19:19 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <858ce927810623092225a56aa6369e5b6965221e-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="+CA2pn3B9yI="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: CMake: Sync list of compiler flags with configure.ac List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --+CA2pn3B9yI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/92= 3?usp=3Demail ) Change subject: CMake: Sync list of compiler flags with configure.ac ...................................................................... CMake: Sync list of compiler flags with configure.ac Also fix one issue reported by the build. Change-Id: I28af9eac2e9fb615903a82c8f4087602b72c134d Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Message-Id: <20250509090936.18818-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 604.html Signed-off-by: Gert Doering --- M CMakeLists.txt M tests/unit_tests/openvpn/test_cryptoapi.c 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6687b56..c19d29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,13 @@ CACHE STRING "Flags used by the C++ compiler during AddressSanitizer b= uilds." FORCE) +function(check_and_add_compiler_flag flag variable) + check_c_compiler_flag(${flag} ${variable}) + if (${variable}) + add_compile_options(${flag}) + endif() +endfunction() + if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE = -D_WINSOCK_DEPRECATED_NO_WARNINGS) if (USE_WERROR) @@ -96,11 +103,9 @@ endif() else () add_compile_options(-Wall -Wuninitialized) - check_c_compiler_flag(-Wno-stringop-truncation NoStringOpTruncation) - - if (${NoStringOpTruncation}) - add_compile_options(-Wno-stringop-truncation) - endif() + check_and_add_compiler_flag(-Wno-stringop-truncation NoStringOpTruncat= ion) + 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) if (USE_WERROR) diff --git a/tests/unit_tests/openvpn/test_cryptoapi.c b/tests/unit_tests/o= penvpn/test_cryptoapi.c index 98102ef..478995f 100644 --- a/tests/unit_tests/openvpn/test_cryptoapi.c +++ b/tests/unit_tests/openvpn/test_cryptoapi.c @@ -116,7 +116,7 @@ /* Fill-in certs[] array */ void -init_cert_data() +init_cert_data(void) { struct test_cert certs_local[] =3D { {cert1, key1, cname1, "OVPN TEST CA1", "OVPN Test Cert 1", ha= sh1, 1}, -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/923?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: I28af9eac2e9fb615903a82c8f4087602b72c134d Gerrit-Change-Number: 923 Gerrit-PatchSet: 3 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --+CA2pn3B9yI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

CMake: Sync list of compiler flags with config=
ure.ac

Also fix one issue reported by the build.

Change-Id: I= 28af9eac2e9fb615903a82c8f4087602b72c134d
Signed-off-by: Frank Lichtenhel= d <frank@...2641...>
Acked-by: Arne Schwabe <arne-openvpn@...1711...= 27...>
Message-Id: <20250509090936.18818-1-gert@...1296...>
= URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 604.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M= CMakeLists.txt
M tests/unit_tests/openvpn/test_cryptoapi.c
2 files c= hanged, 11 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6687b= 56..c19d29a 100644
--- a/CMakeLists.txt
+++= b/CMakeLists.txt
@@ -66,6 +66,13 @@
C= ACHE STRING "Flags used by the C++ compiler during AddressSanitizer bu= ilds."
FORCE)

+function(check_and_add_compiler_flag = flag variable)
+ c= heck_c_compiler_flag(${flag} ${variable})
+ if (${variable})
+ add_compile_options(${flag})
+ endif()
+endfunction()
+
if (MSVC)
= add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_= WINSOCK_DEPRECATED_NO_WARNINGS)
if (USE_WERROR)=
@@ -96,11 +103,9 @@
endif()
= else ()
add_compile_options(-Wall -Wuninitialized)
- check_c_compiler_fla= g(-Wno-stringop-truncation NoStringOpTruncation)
-
- if (${NoStringOpTruncation})
- add_compile_options(-Wno-stringop-truncation)
- endif()
+ check_and_add_compiler_flag(-W= no-stringop-truncation NoStringOpTruncation)

+ check_and_add_compiler_flag(-Wstrict-prototype= s StrictPrototypes)
+= check_and_add_compiler_flag(-Wold-style-definition OldStyleDefinition)<= /span>
# We are not ready for this
#add_= compile_options(-Wconversion -Wno-sign-conversion -Wsign-compare) if (USE_WERROR)
diff --git a/tests/unit_tests/o= penvpn/test_cryptoapi.c b/tests/unit_tests/openvpn/test_cryptoapi.c<= br>index 98102ef..478995f 100644
--- a/tests/unit_tes= ts/openvpn/test_cryptoapi.c
+++ b/tests/unit_tests/openvpn/= test_cryptoapi.c
@@ -116,7 +116,7 @@

/* Fill-in certs[] array */
void
-init_cert_data()

+init_cert_data(void)
= {
struct test_cert certs_local[] =3D {
{cert1, key1, cname1, "OVPN TEST CA1", "OVPN = Test Cert 1", hash1, 1},


To view= , visit c= hange 923. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I28af9eac2e9fb615903a82c8f40= 87602b72c134d
Gerrit-Change-Number: 923
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--+CA2pn3B9yI=--