From: "cron2 (Code Review)" Date: Fri, 27 Dec 2024 11:39:22 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <820e9273bf6422670c11884b462723a090005b0e-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="khj5adgcQCg="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Add building/testing with msbuild and the clang compiler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld , stipa Cc: openvpn-devel --khj5adgcQCg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#7) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/751?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by stipa Change subject: Add building/testing with msbuild and the clang compiler ...................................................................... Add building/testing with msbuild and the clang compiler The LLVM/clang compiler warning and error message are easier too read than their MSVC cl counterparts. Also compiling/running tests on Windows with a different compiler has the benefit of a better coverage. This includes a few minor changes to allow clang-cl to compile the project. Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d Signed-off-by: Arne Schwabe Acked-by: Lev Stipakov Message-Id: <20241227112209.11572-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 231.html Signed-off-by: Gert Doering --- M .github/workflows/build.yaml M CMakeLists.txt M CMakePresets.json M config.h.cmake.in M src/openvpnmsica/openvpnmsica.c M src/openvpnmsica/openvpnmsica.h M tests/unit_tests/openvpn/test_buffer.c 7 files changed, 81 insertions(+), 17 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/7 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3958ef0..767de0b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -259,7 +259,7 @@ strategy: fail-fast: false matrix: - arch: [amd64, x86, arm64] + arch: [amd64, x86, arm64, amd64-clang, x86-clang] name: "msbuild - ${{ matrix.arch }} - openssl" env: diff --git a/CMakeLists.txt b/CMakeLists.txt index 61f0cc5..5b5b7ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -627,7 +627,8 @@ check_linker_flag(C -Wl,--wrap=3Dparse_line LD_SUPPORTS_WRAP) endif() - if (${LD_SUPPORTS_WRAP}) + # Clang-cl (which is also MSVC) is wrongly detected to support wrap + if (NOT MSVC AND "${LD_SUPPORTS_WRAP}") list(APPEND unit_tests "test_argv" "test_tls_crypt" diff --git a/CMakePresets.json b/CMakePresets.json index 135b19d..b6ec201 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -122,6 +122,10 @@ } }, { + "name": "clangtoolset", + "toolset": "ClangCL" + }, + { "name": "mingw-x64", "inherits": [ "base", "base-mingw", "x64-mingw" ] }, @@ -134,6 +138,10 @@ "inherits": [ "base", "base-windows", "x64", "release" ] }, { + "name": "win-amd64-clang-release", + "inherits": [ "base", "base-windows", "clangtoolset", "x64", "= release" ] + }, + { "name": "win-arm64-release", "inherits": [ "base", "base-windows", "arm64", "release" ] }, @@ -142,10 +150,18 @@ "inherits": [ "base", "base-windows", "x86", "release" ] }, { + "name": "win-x86-clang-release", + "inherits": [ "base", "base-windows", "clangtoolset", "x86", "= release" ] + }, + { "name": "win-amd64-debug", "inherits": [ "base", "base-windows", "x64", "debug" ] }, { + "name": "win-amd64-clang-debug", + "inherits": [ "base", "base-windows", "clangtoolset", "x64", "= debug" ] + }, + { "name": "win-arm64-debug", "inherits": [ "base", "base-windows", "arm64", "debug" ] }, @@ -154,6 +170,10 @@ "inherits": [ "base", "base-windows", "x86", "debug" ] }, { + "name": "win-x86-clang-debug", + "inherits": [ "base", "base-windows", "clangtoolset", "x86", "= debug" ] + }, + { "name": "unix-native", "generator": "Ninja Multi-Config", "binaryDir": "out/build/unix" @@ -174,6 +194,11 @@ "configuration": "Release" }, { + "name": "win-amd64-clang-release", + "configurePreset": "win-amd64-clang-release", + "configuration": "Release" + }, + { "name": "win-arm64-release", "configurePreset": "win-arm64-release", "configuration": "Release" @@ -184,11 +209,21 @@ "configuration": "Release" }, { + "name": "win-x86-clang-release", + "configurePreset": "win-x86-clang-release", + "configuration": "Release" + }, + { "name": "win-amd64-debug", "configurePreset": "win-amd64-debug", "configuration": "Debug" }, { + "name": "win-amd64-clang-debug", + "configurePreset": "win-amd64-clang-debug", + "configuration": "Debug" + }, + { "name": "win-arm64-debug", "configurePreset": "win-arm64-debug", "configuration": "Debug" @@ -199,6 +234,11 @@ "configuration": "Debug" }, { + "name": "win-x86-clang-debug", + "configurePreset": "win-x86-clang-debug", + "configuration": "Debug" + }, + { "name": "unix-native", "configurePreset": "unix-native" } @@ -209,18 +249,34 @@ "configurePreset": "win-amd64-release" }, { + "name": "win-amd64-clang-release", + "configurePreset": "win-amd64-clang-release" + }, + { "name": "win-x86-release", "configurePreset": "win-x86-release" }, { + "name": "win-x86-clang-release", + "configurePreset": "win-x86-clang-release" + }, + { "name": "win-amd64-debug", "configurePreset": "win-amd64-debug" }, { + "name": "win-amd64-clang-debug", + "configurePreset": "win-amd64-clang-debug" + }, + { "name": "win-x86-debug", "configurePreset": "win-x86-debug" }, { + "name": "win-x86-clang-debug", + "configurePreset": "win-x86-clang-debug" + }, + { "name": "unix-native", "configurePreset": "unix-native" } diff --git a/config.h.cmake.in b/config.h.cmake.in index 3c517d7..74a53a6 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -439,8 +439,10 @@ # define _GNU_SOURCE 1 #endif - -#if defined(_WIN32) +/* if inttypes.h is included this breaks rc.exe when using the ClangCL + * Toolchain as it pulls in a inttypes.h variant for clang that rc.exe does + * not understand (#include_next preprocessor directive) */ +#if defined(_WIN32) && !defined(RC_INVOKED) #include typedef uint32_t in_addr_t; typedef uint16_t in_port_t; @@ -452,7 +454,7 @@ #define SIGTERM 15 #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(RC_INVOKED) #include typedef SSIZE_T ssize_t; #define strncasecmp strnicmp diff --git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsic= a.c index 154fff4..17152e0 100644 --- a/src/openvpnmsica/openvpnmsica.c +++ b/src/openvpnmsica/openvpnmsica.c @@ -303,7 +303,7 @@ UINT __stdcall FindSystemInfo(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT) #endif @@ -340,7 +340,7 @@ UINT __stdcall CloseOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT) #endif UNREFERENCED_PARAMETER(hInstall); /* This CA is does not interact with= MSI session (report errors, access properties, tables, etc.). */ @@ -363,7 +363,7 @@ UINT __stdcall StartOpenVPNGUI(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT) #endif @@ -636,7 +636,7 @@ UINT __stdcall EvaluateTUNTAPAdapters(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT) #endif @@ -789,7 +789,7 @@ { goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) /* * warning: enumeration value =E2=80=98MSICONDITION_TRUE=E2=80=99 not hand= led in switch * warning: enumeration value =E2=80=98MSICONDITION_NONE=E2=80=99 not hand= led in switch @@ -809,7 +809,7 @@ free(szValue); goto cleanup_szDisplayName; } -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif free(szValue); @@ -965,7 +965,7 @@ UINT __stdcall ProcessDeferredAction(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT) #endif @@ -1165,7 +1165,7 @@ UINT __stdcall CheckAndScheduleReboot(_In_ MSIHANDLE hInstall) { -#ifdef _MSC_VER +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT) #endif diff --git a/src/openvpnmsica/openvpnmsica.h b/src/openvpnmsica/openvpnmsic= a.h index 7aacdf3..761aa47 100644 --- a/src/openvpnmsica/openvpnmsica.h +++ b/src/openvpnmsica/openvpnmsica.h @@ -66,7 +66,11 @@ extern "C" { #endif -#ifdef __GNUC__ +/* Ensure that clang-cl, which does not understand the cl specific + * preprocessor defines like #pragma comment(linker, DLLEXP_EXPORT) + * is handled the same way as mingw and uses the alternative instead + * and does not define DLLEXP_EXPORT */ +#if defined(__GNUC__) || defined(__clang__) #define DLLEXP_DECL __declspec(dllexport) #else #define DLLEXP_DECL diff --git a/tests/unit_tests/openvpn/test_buffer.c b/tests/unit_tests/open= vpn/test_buffer.c index d43d5c1..3a1007a 100644 --- a/tests/unit_tests/openvpn/test_buffer.c +++ b/tests/unit_tests/openvpn/test_buffer.c @@ -389,8 +389,9 @@ /* Instead of trying to trick the compiler here, disable the warnings * for this unit test. We know that the results will be truncated - * and we want to test that */ -#if defined(__GNUC__) + * and we want to test that. Not we need the clang as clang-cl (msvc) = does + * not define __GNUC__ like it does under UNIX(-like) platforms */ +#if defined(__GNUC__) || defined(__clang__) /* some clang version do not understand -Wformat-truncation, so ignore the * warning to avoid warnings/errors (-Werror) about unknown pragma/option = */ #if defined(__clang__) @@ -418,7 +419,7 @@ assert_int_equal(ret, 10); assert_int_equal(buf[9], '\0'); -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #if defined(__clang__) #pragma clang diagnostic pop -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/751?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: I43d84034f3e920a45731c4aab4f851a60921290d Gerrit-Change-Number: 751 Gerrit-PatchSet: 7 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: stipa Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --khj5adgcQCg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #7 to the change originally cr= eated by plaisthos.

View Change

The following approvals got outdated= and were removed: Code-Review+2 by stipa

Add building/testing with msbuild and the clang comp=
iler

The LLVM/clang compiler warning and error message are easier to= o read
than their MSVC cl counterparts. Also compiling/running tests on = Windows
with a different compiler has the benefit of a better coverage.<= br>
This includes a few minor changes to allow clang-cl to compile theproject.

Change-Id: I43d84034f3e920a45731c4aab4f851a60921290d
S= igned-off-by: Arne Schwabe <arne@...1227...>
Acked-by: Lev Stipako= v <lstipakov@...277...>
Message-Id: <20241227112209.11572-1-ger= t@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1096...= ourceforge.net/msg30231.html
Signed-off-by: Gert Doering <gert@...1826...= 6...>
---
M .github/workflows/build.yaml
M CMakeLists.txt
M = CMakePresets.json
M config.h.cmake.in
M src/openvpnmsica/openvpnmsica= .c
M src/openvpnmsica/openvpnmsica.h
M tests/unit_tests/openvpn/test_= buffer.c
7 files changed, 81 insertions(+), 17 deletions(-)

gi=
t pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/51/751/7
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 3958ef0..767de0b 100644
--- a/.github/= workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -259,7 +259,7 @@
strategy: fail-fast: false
matrix:- arch: [amd64, x86, ar= m64]
+ arch:= [amd64, x86, arm64, amd64-clang, x86-clang]

name: "msbuild - ${{ matrix.arch }} - openssl"
<= br> env:
diff --git a/CMakeLists.txt b/CMakeLis= ts.txt
index 61f0cc5..5b5b7ff 100644
--- a/= CMakeLists.txt
+++ b/CMakeLists.txt
@@ -627= ,7 +627,8 @@
check_linker_flag(C -Wl,--wrap=3Dpars= e_line LD_SUPPORTS_WRAP)
endif()

- if (${LD_SUPPORTS_WRA= P})
+ # Clang-cl (= which is also MSVC) is wrongly detected to support wrap
+ if (NOT MSVC AND "${LD_SUPPORT= S_WRAP}")
list(APPEND unit_tests
"test_argv"

"t= est_tls_crypt"
diff --git a/CMakePresets.json b/CMakeP= resets.json
index 135b19d..b6ec201 100644
-= -- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -122,6 +122,10 @@
}
= },
{
+ "name": "clangtoolset",
+ "tools= et": "ClangCL"
+ },
= + {
"name": "mingw-x64&q= uot;,
"inherits": [ "base"= , "base-mingw", "x64-mingw" ]
= },
@@ -134,6 +138,10 @@
"= inherits": [ "base", "base-windows", "x64&quo= t;, "release" ]
},
= {
+ &q= uot;name": "win-amd64-clang-release",
+ "inherits": [ "= ;base", "base-windows", "clangtoolset", "x64&= quot;, "release" ]
+ },
+= {
"name": "win-arm64-re= lease",
"inherits": [ "bas= e", "base-windows", "arm64", "release" ]=
},
@@ -142,10 +150,18 @@ "inherits": [ "base", "base-w= indows", "x86", "release" ]
= },
{
+ "name": "win-x86-clang-release"= ;,
+ "= ;inherits": [ "base", "base-windows", "clangt= oolset", "x86", "release" ]
+ },
+ {
"name&= quot;: "win-amd64-debug",
"inhe= rits": [ "base", "base-windows", "x64", = "debug" ]
},
{<= /span>
+ "na= me": "win-amd64-clang-debug",
+ "inherits": [ "base&quo= t;, "base-windows", "clangtoolset", "x64", &q= uot;debug" ]
+ = },
+ {
"name": "win-arm64-debug",<= /span>
"inherits": [ "base", &quo= t;base-windows", "arm64", "debug" ]
},

@@ -154,6 +170,10 @@
= "inherits": [ "base", "base-windows", &q= uot;x86", "debug" ]
},
{

+ = "name": "win-x86-clang-debug",
+ "inherits": [ &= quot;base", "base-windows", "clangtoolset", "= x86", "debug" ]
+ },
+ {
"name": "unix-nativ= e",
"generator": "Ninja Mu= lti-Config",
"binaryDir": "= ;out/build/unix"
@@ -174,6 +194,11 @@
= "configuration": "Release"
},

{
+ "name": "win-amd64-clang-rel= ease",
+ = "configurePreset": "win-amd64-clang-release",

+ "configu= ration": "Release"
+ },
+ {
"name": "win-arm= 64-release",
"configurePreset":= "win-arm64-release",
"configur= ation": "Release"
@@ -184,11 +209,21 @@
"configuration": "Release"
},
{
+ "name": "win-x= 86-clang-release",
+ "configurePreset": "win-x86-clang-release&qu= ot;,
+ &qu= ot;configuration": "Release"
+ },
+ {
"name": &qu= ot;win-amd64-debug",
"configurePrese= t": "win-amd64-debug",
"co= nfiguration": "Debug"
},
= {
+ = "name": "win-amd64-clang-debug",
+ "configurePreset= ": "win-amd64-clang-debug",

+ "configuration": "Debug&q= uot;
+ },
+ {
"name": "win-arm64-debug",

"configurePreset": "win-arm64-debug",
"configuration": "Debug"
@@ -199,6 +234,11 @@
"confi= guration": "Debug"
},
{

+ = "name": "win-x86-clang-debug",
+ "configurePreset"= ;: "win-x86-clang-debug",
+ "configuration": "Debug"
+ },
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

= "name": "unix-native",
= "configurePreset": "unix-native"
= }
@@ -209,18 +249,34 @@
= "configurePreset": "win-amd64-release"
},

{
+ "name": "win-amd64-clang-re= lease",
+ = "configurePreset": "win-amd64-clang-release"
+ },
+ {

= "name": "win-x86-release",
= "configurePreset": "win-x86-release"
},
{
+ "name": "win-x86-clang-re= lease",
+ = "configurePreset": "win-x86-clang-release"<= br>+ },
+ {
= "name": "win-amd64-debug",
= "configurePreset": "win-amd64-debug"
},
{
+ "name": "win-amd64-clang-de= bug",
+ = "configurePreset": "win-amd64-clang-debug"+ },
+ {
= "name": "win-x86-debug",
= "configurePreset": "win-x86-debug"
= },
{
+ "name": "win-x86-clang-debug"= ;,
+ "= ;configurePreset": "win-x86-clang-debug"
+ },
+ {
"nam= e": "unix-native",
"config= urePreset": "unix-native"
}<= br>diff --git a/config.h.cmake.in b/config.h.cmake.in
index 3c517d7..74a53a6 100644
--- a/config.h.cmake.in

+++ b/config.h.cmake.in
@@ -439,8 +439,10 @@

# define _GNU_SOURCE 1
#endif

-
-#if defined(_WIN32)
+/* if inttypes.h is included this brea= ks rc.exe when using the ClangCL
+ * Toolchain as it pulls in a inttypes.h variant for clang tha= t rc.exe does
+ * not= understand (#include_next preprocessor directive) */
+#if defined(_WIN32) && !defined(R= C_INVOKED)
#include <inttypes.h>
ty= pedef uint32_t in_addr_t;
typedef uint16_t in_port_t;
@@ -452,7 +454,7 @@
#define SIGTERM 15
#endif

-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(RC_INVOKED)
#include <BaseTsd.h>
typedef SSIZE_T ss= ize_t;
#define strncasecmp strnicmp
diff -= -git a/src/openvpnmsica/openvpnmsica.c b/src/openvpnmsica/openvpnmsica.c
index 154fff4..17152e0 100644
--- a/src/openv= pnmsica/openvpnmsica.c
+++ b/src/openvpnmsica/openvpnmsica.= c
@@ -303,7 +303,7 @@
UINT __stdcall
FindSystemInfo(_In_ MSIHANDLE hInstall)
{
-#ifdef _MSC_VER
= +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)
#endif

@@ -340,7 +340,7 @@
UINT __s= tdcall
CloseOpenVPNGUI(_In_ MSIHANDLE hInstall)
= {
-#ifdef _MSC_V= ER
+#ifdef DLLEXP_EXP= ORT
#pragma comment(linker, DLLEXP_EXPORT)
#endif

UNREFERENCED_PARAMETER(hInstall); /* This CA = is does not interact with MSI session (report errors, access properties, ta= bles, etc.). */
@@ -363,7 +363,7 @@
UINT _= _stdcall
StartOpenVPNGUI(_In_ MSIHANDLE hInstall) {
-#ifdef _MSC= _VER
+#ifdef DLLEXP_E= XPORT
#pragma comment(linker, DLLEXP_EXPORT)
#endif


@@ -636,7 +636,7 @@
= UINT __stdcall
EvaluateTUNTAPAdapters(_In_ MSIHANDL= E hInstall)
{
-#ifdef _MSC_VER
+#ifdef DLLEXP_EXPORT
#pragma comment(linker, DLLEXP_E= XPORT)
#endif

@@ -789,7 = +789,7 @@
{
= goto cleanup_szDisplayName;
}
-#ifdef __GNUC__
<= span style=3D"color: hsl(120, 100%, 40%);">+#if defined(__GNUC__) || define= d(__clang__)

/*
* warning: enumeration v= alue =E2=80=98MSICONDITION_TRUE=E2=80=99 not handled in switch
* warning: enumeration value =E2=80=98MSICONDITION_NONE=E2=80=99 not = handled in switch

@@ -809,7 +809,7 @@
= free(szValue);
= goto cleanup_szDisplayName;
}
<= span style=3D"color: hsl(0, 100%, 40%);">-#ifdef __GNUC__

+#if defined(__GNUC__) || defined(__cl= ang__)
#pragma GCC diagnostic pop
#endif<= /span>
free(szValue);
@@ -965,7 += 965,7 @@
UINT __stdcall
ProcessDeferredAc= tion(_In_ MSIHANDLE hInstall)
{
-#ifdef _MSC_VER
+#ifdef DLLEXP_EXPORT
#pragma commen= t(linker, DLLEXP_EXPORT)
#endif
@@ -1165,7 +1165,7 @@
UINT __stdcall
CheckAndScheduleReboot(_In_ MSIHANDLE hInstall)

{
-#ifdef _MSC_VER
= +#ifdef DLLEXP_EXPORT #pragma comment(linker, DLLEXP_EXPORT)
#endif

diff --git a/src/openvpnmsica/openvpnmsica.h = b/src/openvpnmsica/openvpnmsica.h
index 7aacdf3..761aa47 10= 0644
--- a/src/openvpnmsica/openvpnmsica.h
= +++ b/src/openvpnmsica/openvpnmsica.h
@@ -66,7 +66,11 @@
extern "C" {
#endif

-#ifdef __GNUC__
+/* Ensure that clang-= cl, which does not understand the cl specific
+ * preprocessor defines like #pragma comment(link= er, DLLEXP_EXPORT)
+ = * is handled the same way as mingw and uses the alternative instead<= br>+ * and does not define DLLE= XP_EXPORT */
+#if def= ined(__GNUC__) || defined(__clang__)
#define DLLEXP_DECL _= _declspec(dllexport)
#else
#define DLLEXP= _DECL
diff --git a/tests/unit_tests/openvpn/test_buffer.c b= /tests/unit_tests/openvpn/test_buffer.c
index d43d5c1..3a10= 07a 100644
--- a/tests/unit_tests/openvpn/test_buffer.c

+++ b/tests/unit_tests/openvpn/test_buffer.c
@= @ -389,8 +389,9 @@

/* Instead of try= ing to trick the compiler here, disable the warnings
= * for this unit test. We know that the results will be truncated
= - * and we want to test that = */
-#if defined(__GNUC_= _)
+ * and we wan= t to test that. Not we need the clang as clang-cl (msvc) does
+ * not define __GNUC__ like i= t does under UNIX(-like) platforms */
+#if defined(__GNUC__) || defined(__clang__)
/* some clang version do not understand -Wformat-truncation, so ignore = the
* warning to avoid warnings/errors (-Werror) about un= known pragma/option */
#if defined(__clang__)
@@ -418,7 +419,7 @@
assert_int_equal(ret, 10);

assert_int_equal(buf[9], '\0');
=
-#if defined(__GNUC__)=
+#if defined(__GNUC_= _) || defined(__clang__)
#pragma GCC diagnostic pop=
#if defined(__clang__)
#pragma clang diagnostic= pop

To view, visit change 751. To unsubscri= be, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43d84034f3e920a45731c4aab4f= 851a60921290d
Gerrit-Change-Number: 751
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: cron2 <gert@...1296...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--khj5adgcQCg=--