From: "flichtenheld (Code Review)" Date: Wed, 8 Oct 2025 12:58:20 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <22c1b75eabc1c6dbd1a94427a50c11ab17bd6d0e-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="M1opaeYDlxY="; 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: plaisthos Cc: openvpn-devel --M1opaeYDlxY= 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/+/1256?usp=3Demail to review the following change. 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 --- M tests/unit_tests/openvpn/test_options_parse.c 1 file changed, 13 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/1256/1 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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6 Gerrit-Change-Number: 1256 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --M1opaeYDlxY= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

test_options_parse: Do not use uintmax_t in=
stead of LargestIntegralType

At least on OpenBSD it seems that uintm= ax_t maps
to unsigned long long always, but LargestIntegralType
is un= signed long. So if we have a version of cmocka.h
that defines LargestInt= egralType then respect that.

Change-Id: I59a49696acd665d43b21e5c23f2= 4b86c15989cd6
Signed-off-by: Frank Lichtenheld <frank@...2641...><= br>---
M tests/unit_tests/openvpn/test_options_parse.c
1 file changed= , 13 insertions(+), 2 deletions(-)

git pull ssh:=
//gerrit.openvpn.net:29418/openvpn refs/changes/56/1256/1
diff --=
git a/tests/unit_tests/openvpn/test_options_parse.c b/tests/unit_tests/open=
vpn/test_options_parse.c
index e552dd7..0ae37f5 100644
--- a/tests/unit_tests/openvpn/test_options_parse.c
<= span>+++ b/tests/unit_tests/openvpn/test_options_parse.c

@@= -198,14 +198,25 @@
&option_typ= es_found, &es);
}

+/* compat with various versions of cmo= cka.h
+ * Older versi= ons have LargestIntegralType. Newer
+ * versions use uintmax_t. But LargestIntegralType+ * is not guaranteed to be e= qual to uintmax_t, so
+ * we can't use that unconditionally. So we only use
+ * it if cmocka.h does not define La= rgestIntegralType.
+ = */
+#ifndef LargestIn= tegralType
+#define L= argestIntegralType uintmax_t
+#endif
+
union tokens_parameter
{
- uintmax_t as_int;
+ LargestIntegralType as_int;<= br> void *as_pointer;
};

static int
= -check_tokens(const uintmax_t value, const uintmax_t expected)
+check_tokens(const LargestIntegr= alType value, const LargestIntegralType expected)

{=
union tokens_parameter temp;
temp.as_in= t =3D value;

To view, visit change 1256. To= unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59a49696acd665d43b21e5c23f2= 4b86c15989cd6
Gerrit-Change-Number: 1256
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...>
= --M1opaeYDlxY=--