You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling on Windows, we use MinGW32, which compiles a 32-bit executable.
As such, the type "size_t" is 32-bit wide even thought the largest type supported (uintmax_t) is 64-bit wide.
So whenever we call "will_return" or "assert_int_equal" and similar macros, we cannot pass a 64-bit value as it gets stripped down to 32-bit by the first cast to size_t. I've copied the culprit macro below, notice the double casting happening there.
// Perform an unsigned cast to uintmax_t.#definecast_to_largest_integral_type(value) \
((uintmax_t)((size_t)(value)))
We've thus far circumvented the problem by creating a local "cmockery.h" file with the following content:
#include<setjmp.h>#include<stdarg.h>#include<stddef.h>#include<stdint.h>#include_next "cmockery.h"
/* Needed because original function "will_return" does a call to cast_to_largest_integral_type(), * which strips the upper 32-bits of a 64-bit integer. This happens because there is an intermediate * cast using size_t */#definewill_return64(function, value) \
_will_return(#function, __FILE__, __LINE__, \
value, 1)
/* Needed because original function "assert_int_equal" does some call to cast_to_largest_integral_type(), * which strips the upper 32-bits of a 64-bit integer. This happens because there is an intermediate * cast using size_t */#defineassert_int_equal64(a, b) \
_assert_int_equal((uintmax_t) a, (uintmax_t) b, __FILE__, __LINE__)
The text was updated successfully, but these errors were encountered:
When compiling on Windows, we use MinGW32, which compiles a 32-bit executable.
As such, the type "size_t" is 32-bit wide even thought the largest type supported (uintmax_t) is 64-bit wide.
So whenever we call "will_return" or "assert_int_equal" and similar macros, we cannot pass a 64-bit value as it gets stripped down to 32-bit by the first cast to size_t. I've copied the culprit macro below, notice the double casting happening there.
We've thus far circumvented the problem by creating a local "cmockery.h" file with the following content:
The text was updated successfully, but these errors were encountered: