From: "flichtenheld (Code Review)" Date: Mon, 22 Sep 2025 15:42:47 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <89696078e73580fc043ae1df3bf0131b0d77de99-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="UsclHRBDDXQ="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Make unit tests -Wconversion clean List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --UsclHRBDDXQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/+/1205?usp=3Demail to review the following change. Change subject: Make unit tests -Wconversion clean ...................................................................... Make unit tests -Wconversion clean Only trivial problems left after the other patches have been merged. Change-Id: Iab9e780d9649d7581e5f6aa4b23e72bbed5e145b Signed-off-by: Frank Lichtenheld --- M tests/unit_tests/openvpn/test_crypto.c M tests/unit_tests/openvpn/test_ssl.c 2 files changed, 4 insertions(+), 22 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/05/1205/1 diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/open= vpn/test_crypto.c index 22e6912..93dfa42 100644 --- a/tests/unit_tests/openvpn/test_crypto.c +++ b/tests/unit_tests/openvpn/test_crypto.c @@ -674,15 +674,10 @@ struct crypto_options co; }; -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static int crypto_test_epoch_setup(void **state) { - int *num_future_keys =3D (int *)*state; + uint16_t *num_future_keys =3D (uint16_t *)*state; struct epoch_test_state *data =3D calloc(1, sizeof(struct epoch_test_s= tate)); data->gc =3D gc_new(); @@ -699,10 +694,6 @@ return 0; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static int crypto_test_epoch_teardown(void **state) { @@ -906,9 +897,9 @@ int main(void) { - int prestate_num13 =3D 13; - int prestate_num16 =3D 16; - int prestate_num32 =3D 32; + uint16_t prestate_num13 =3D 13; + uint16_t prestate_num16 =3D 16; + uint16_t prestate_num32 =3D 32; openvpn_unit_test_setup(); const struct CMUnitTest tests[] =3D { diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn= /test_ssl.c index ed40a7d..bb02fcc 100644 --- a/tests/unit_tests/openvpn/test_ssl.c +++ b/tests/unit_tests/openvpn/test_ssl.c @@ -133,11 +133,6 @@ const char *keyfile; } global_state; -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static int init(void **state) { @@ -159,10 +154,6 @@ return 0; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static int cleanup(void **state) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1205?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: Iab9e780d9649d7581e5f6aa4b23e72bbed5e145b Gerrit-Change-Number: 1205 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --UsclHRBDDXQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

Make unit tests -Wconversion clean

Only trivial probl= ems left after the other patches
have been merged.

Change-Id: Iab= 9e780d9649d7581e5f6aa4b23e72bbed5e145b
Signed-off-by: Frank Lichtenheld = <frank@...2641...>
---
M tests/unit_tests/openvpn/test_crypto.c=
M tests/unit_tests/openvpn/test_ssl.c
2 files changed, 4 insertions(= +), 22 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openv=
pn refs/changes/05/1205/1
diff --git a/tests/unit_tests/openvpn/tes=
t_crypto.c b/tests/unit_tests/openvpn/test_crypto.c
index 2= 2e6912..93dfa42 100644
--- a/tests/unit_tests/openvpn/test_= crypto.c
+++ b/tests/unit_tests/openvpn/test_crypto.c
@@ -674,15 +674,10 @@
struct crypto_options= co;
};

-#if defined(__GNUC__) || defined(__clang__)
= -#pragma GCC diagnostic push
-#pragma GCC diagnostic ign= ored "-Wconversion"
-#endif
-=
static int
crypto_test_epoch_setup(void **state= )
{
- = int *num_future_keys =3D (int *)*state;
+ uint16_t *num_future_keys =3D (uint16_t *)*state= ;
struct epoch_test_state *data =3D calloc(1, sizeof(s= truct epoch_test_state));

data->g= c =3D gc_new();
@@ -699,10 +694,6 @@
r= eturn 0;
}

-#if defined(__GNUC__) || defined(__clang__)<= br>-#pragma GCC diagnostic pop
-#endif
-
static int
= crypto_test_epoch_teardown(void **state)
{@@ -906,9 +897,9 @@
int
main(void= )
{
- = int prestate_num13 =3D 13;
- int prestate_num16 =3D 16;
- int prestate_num32 =3D 32;
+ uint16_t prestate_num13 =3D 13;
<= span style=3D"color: hsl(120, 100%, 40%);">+ uint16_t prestate_num16 =3D= 16;

+ uint16_t pr= estate_num32 =3D 32;

openvpn_unit_te= st_setup();
const struct CMUnitTest tests[] =3D {
diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_t= ests/openvpn/test_ssl.c
index ed40a7d..bb02fcc 100644
--- a/tests/unit_tests/openvpn/test_ssl.c
+++ b/= tests/unit_tests/openvpn/test_ssl.c
@@ -133,11 +133,6 @@
const char *keyfile;
} global_state;

-#if de= fined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion&quo= t;
-#endif
-

static int
init(void **state)
{
@@ -159,1= 0 +154,6 @@
return 0;
}

-#if defined(__GNU= C__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
static int
cleanup(void **state)
{


To view, visit change 1205. To unsub= scribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iab9e780d9649d7581e5f6aa4b23= e72bbed5e145b
Gerrit-Change-Number: 1205
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--UsclHRBDDXQ=--