]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
CMake: Sync list of compiler flags with configure.ac
authorFrank Lichtenheld <frank@lichtenheld.com>
Fri, 9 May 2025 09:09:31 +0000 (11:09 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 9 May 2025 10:16:27 +0000 (12:16 +0200)
Also fix one issue reported by the build.

Change-Id: I28af9eac2e9fb615903a82c8f4087602b72c134d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Message-Id: <20250509090936.18818-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31604.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
CMakeLists.txt
tests/unit_tests/openvpn/test_cryptoapi.c

index 6687b56f124bcfeecd9ee749b98d6bbd469667df..c19d29a60c35f99fe2e1e5aa0c070d5f293de3d8 100644 (file)
@@ -66,6 +66,13 @@ set(CMAKE_CXX_FLAGS_ASAN
     CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds."
     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 @@ if (MSVC)
     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 NoStringOpTruncation)
+    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)
index 98102ef2949a6559120bdc59a10ddeffacf7a605..478995f250408d517893bb81f386c0c9771b6c1a 100644 (file)
@@ -116,7 +116,7 @@ static HCERTSTORE user_store;
 
 /* Fill-in certs[] array */
 void
-init_cert_data()
+init_cert_data(void)
 {
     struct test_cert certs_local[] = {
         {cert1,  key1,  cname1,  "OVPN TEST CA1",  "OVPN Test Cert 1",  hash1,  1},