Skip to content

Commit 5b8e056

Browse files
flichtenheldcron2
authored andcommitted
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 <[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]>
1 parent cdbb3e4 commit 5b8e056

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/unit_tests/openvpn/test_options_parse.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,25 @@ read_single_config(struct options *options, const char *config)
198198
&option_types_found, &es);
199199
}
200200

201+
/* compat with various versions of cmocka.h
202+
* Older versions have LargestIntegralType. Newer
203+
* versions use uintmax_t. But LargestIntegralType
204+
* is not guaranteed to be equal to uintmax_t, so
205+
* we can't use that unconditionally. So we only use
206+
* it if cmocka.h does not define LargestIntegralType.
207+
*/
208+
#ifndef LargestIntegralType
209+
#define LargestIntegralType uintmax_t
210+
#endif
211+
201212
union tokens_parameter
202213
{
203-
uintmax_t as_int;
214+
LargestIntegralType as_int;
204215
void *as_pointer;
205216
};
206217

207218
static int
208-
check_tokens(const uintmax_t value, const uintmax_t expected)
219+
check_tokens(const LargestIntegralType value, const LargestIntegralType expected)
209220
{
210221
union tokens_parameter temp;
211222
temp.as_int = value;

0 commit comments

Comments
 (0)