Skip to contentSkip to conversation

Change in openvpn[master]: test_options_parse: Do not use uintmax_t instead of LargestIntegralType

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Oct 8, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1759928297000.I59a49696acd665d43b21e5c23f24b86c15989cd6@...2715...

#1 lore raw

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=email

to review the following change.

Change subject: test_options_parse: Do not use uintmax_t instead of LargestIntegralType
......................................................................

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

---
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

tests/unit_tests/openvpn/test_options_parse.c +13 -2
index e552dd7..0ae37f5 100644
@@ -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 expected)
 {
     union tokens_parameter temp;
     temp.as_int = value;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6
Gerrit-Change-Number: 1256
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email )

Change subject: test_options_parse: Do not use uintmax_t instead of LargestIntegralType
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6
Gerrit-Change-Number: 1256
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 08 Oct 2025 13:33:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 test_options_parse: Do not use uintmax_t instead of LargestIntegralType

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

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

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

tests/unit_tests/openvpn/test_options_parse.c +13 -2
index e552dd7..0ae37f5 100644
@@ -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 expected)
 {
     union tokens_parameter temp;
     temp.as_int = value;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: test_options_parse: Do not use uintmax_t instead of LargestIntegralType

Explanation makes sense, code change appeases the loud complaints from OpenBSD BB with -Werror. In it goes :-)

Your patch has been applied to the master branch.

commit 5b8e0563f950aa5d246f32785afffd8824d9f9ab

Author: Frank Lichtenheld
Date:   Wed Oct 8 15:33:31 2025 +0200
     test_options_parse: Do not use uintmax_t instead of LargestIntegralType

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59243971/
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email )

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

Change subject: test_options_parse: Do not use uintmax_t instead of LargestIntegralType
......................................................................

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

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243971/

---
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/2

tests/unit_tests/openvpn/test_options_parse.c +13 -2
index e552dd7..0ae37f5 100644
@@ -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 expected)
 {
     union tokens_parameter temp;
     temp.as_int = value;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6
Gerrit-Change-Number: 1256
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email )

Change subject: test_options_parse: Do not use uintmax_t instead of LargestIntegralType
......................................................................

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

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1256
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243971/

---
M tests/unit_tests/openvpn/test_options_parse.c

1 file changed, 13 insertions(+), 2 deletions(-)
tests/unit_tests/openvpn/test_options_parse.c +13 -2
index e552dd7..0ae37f5 100644
@@ -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 expected)
 {
     union tokens_parameter temp;
     temp.as_int = value;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1256?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I59a49696acd665d43b21e5c23f24b86c15989cd6
Gerrit-Change-Number: 1256
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>