From: "cron2 (Code Review)" Date: Wed, 8 Oct 2025 13:40:55 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <18988882db6eda0b73057e8c981b9c2e87322870-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="iBdRHoS/a/0="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: test_options_parse: Do not use uintmax_t instead of LargestIntegralType List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --iBdRHoS/a/0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/12= 56?usp=3Demail ) Change subject: test_options_parse: Do not use uintmax_t instead of Largest= IntegralType ...................................................................... test_options_parse: Do not use uintmax_t instead of LargestIntegralType At least on OpenBSD it seems that uintmax_t maps to unsigned long long always, but LargestIntegralType is unsigned long. So if we have a version of cmocka.h that defines LargestIntegralType then respect that. Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256 Message-Id: <20251008133338.23652-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59243971/ Signed-off-by: Gert Doering --- M tests/unit_tests/openvpn/test_options_parse.c 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests/openvpn/test_options_parse.c b/tests/unit_tes= ts/openvpn/test_options_parse.c index e552dd7..0ae37f5 100644 --- a/tests/unit_tests/openvpn/test_options_parse.c +++ b/tests/unit_tests/openvpn/test_options_parse.c @@ -198,14 +198,25 @@ &option_types_found, &es); } +/* compat with various versions of cmocka.h + * Older versions have LargestIntegralType. Newer + * versions use uintmax_t. But LargestIntegralType + * is not guaranteed to be equal to uintmax_t, so + * we can't use that unconditionally. So we only use + * it if cmocka.h does not define LargestIntegralType. + */ +#ifndef LargestIntegralType +#define LargestIntegralType uintmax_t +#endif + union tokens_parameter { - uintmax_t as_int; + LargestIntegralType as_int; void *as_pointer; }; static int -check_tokens(const uintmax_t value, const uintmax_t expected) +check_tokens(const LargestIntegralType value, const LargestIntegralType ex= pected) { union tokens_parameter temp; temp.as_int =3D value; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1256?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6 Gerrit-Change-Number: 1256 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --iBdRHoS/a/0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

test_options_parse: Do not use uintmax_t instead=
 of LargestIntegralType

At least on OpenBSD it seems that uintmax_t = maps
to unsigned long long always, but LargestIntegralType
is unsigne= d long. So if we have a version of cmocka.h
that defines LargestIntegral= Type then respect that.

Change-Id: I59a49696acd665d43b21e5c23f24b86c= 15989cd6
Signed-off-by: Frank Lichtenheld <frank@...2641...>
Ac= ked-by: Gert Doering <gert@...1296...>
Gerrit URL: https://gerrit.= openvpn.net/c/openvpn/+/1256
Message-Id: <20251008133338.23652-1-gert= @...1296...>
URL: https://sourceforge.net/p/openvpn/mailman/message/5= 9243971/
Signed-off-by: Gert Doering <gert@...1296...>
---
M= tests/unit_tests/openvpn/test_options_parse.c
1 file changed, 13 insert= ions(+), 2 deletions(-)

diff --git a/tests/unit_tests/openvpn/test_options_parse.c b/tests/unit_=
tests/openvpn/test_options_parse.c
index e552dd7..0ae37f5 1= 00644
--- a/tests/unit_tests/openvpn/test_options_parse.c
+++ b/tests/unit_tests/openvpn/test_options_parse.c@@ -198,14 +198,25 @@
&= option_types_found, &es);
}
+/* compat with various versi= ons of cmocka.h
+ * O= lder versions have LargestIntegralType. Newer
+ * versions use uintmax_t. But LargestIntegralTyp= e
+ * is not guarante= ed to be equal to uintmax_t, so
+ * we can't use that unconditionally. So we only use=
+ * it if cmocka.h does not= define LargestIntegralType.
+ */
+#ifndef= LargestIntegralType
= +#define LargestIntegralType uintmax_t
+#endif
+
union tokens_parameter
{- uintmax_t as_int;+ LargestIntegralType as_in= t;
void *as_pointer;
};

static int
-check_tokens(const uintmax_t value, const uintmax_t expected)
+check_tokens(const Lar= gestIntegralType value, const LargestIntegralType expected)
{

union tokens_parameter temp;
= temp.as_int =3D value;

To view, visit <= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/1256?usp=3Demail">change 12= 56. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59a49696acd665d43b21e5c23f2= 4b86c15989cd6
Gerrit-Change-Number: 1256
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --iBdRHoS/a/0=--