mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 11:17:29 +02:00
Merge pull request #5104 from tmael/32_bit_ssize
Fix for stack and heap measurements of a 32-bit build
This commit is contained in:
@ -630,8 +630,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
wolfSSL_Cleanup();
|
wolfSSL_Cleanup();
|
||||||
printf("\nAll tests passed!\n");
|
printf("\nAll tests passed!\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
EXIT_TEST(EXIT_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@
|
|||||||
const ssize_t _rha = wolfCrypt_heap_peakAllocs_checkpoint() - heap_baselineAllocs; \
|
const ssize_t _rha = wolfCrypt_heap_peakAllocs_checkpoint() - heap_baselineAllocs; \
|
||||||
const ssize_t _rhb = wolfCrypt_heap_peakBytes_checkpoint() - heap_baselineBytes; \
|
const ssize_t _rhb = wolfCrypt_heap_peakBytes_checkpoint() - heap_baselineBytes; \
|
||||||
printf(" relative heap peak usage: %ld alloc%s, %ld bytes\n", \
|
printf(" relative heap peak usage: %ld alloc%s, %ld bytes\n", \
|
||||||
_rha, \
|
(long int)_rha, \
|
||||||
_rha == 1 ? "" : "s", \
|
_rha == 1 ? "" : "s", \
|
||||||
_rhb); \
|
(long int)_rhb); \
|
||||||
if ((max_relative_heap_allocs > 0) && (_rha > max_relative_heap_allocs)) \
|
if ((max_relative_heap_allocs > 0) && (_rha > max_relative_heap_allocs)) \
|
||||||
return err_sys("heap allocs exceed designated max.", -1); \
|
return err_sys("heap allocs exceed designated max.", -1); \
|
||||||
if ((max_relative_heap_bytes > 0) && (_rhb > max_relative_heap_bytes)) \
|
if ((max_relative_heap_bytes > 0) && (_rhb > max_relative_heap_bytes)) \
|
||||||
|
@ -250,7 +250,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef SINGLE_THREADED
|
#ifdef SINGLE_THREADED
|
||||||
|
#if defined(WC_32BIT_CPU)
|
||||||
|
typedef void* THREAD_RETURN;
|
||||||
|
#else
|
||||||
typedef unsigned int THREAD_RETURN;
|
typedef unsigned int THREAD_RETURN;
|
||||||
|
#endif
|
||||||
typedef void* THREAD_TYPE;
|
typedef void* THREAD_TYPE;
|
||||||
#define WOLFSSL_THREAD
|
#define WOLFSSL_THREAD
|
||||||
#else
|
#else
|
||||||
@ -3055,7 +3059,7 @@ int StackSizeHWMReset(void)
|
|||||||
#define STACK_SIZE_CHECKPOINT(...) ({ \
|
#define STACK_SIZE_CHECKPOINT(...) ({ \
|
||||||
ssize_t HWM = StackSizeHWM_OffsetCorrected(); \
|
ssize_t HWM = StackSizeHWM_OffsetCorrected(); \
|
||||||
__VA_ARGS__; \
|
__VA_ARGS__; \
|
||||||
printf(" relative stack peak usage = %ld bytes\n", HWM); \
|
printf(" relative stack peak usage = %ld bytes\n", (long int)HWM); \
|
||||||
StackSizeHWMReset(); \
|
StackSizeHWMReset(); \
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -3063,10 +3067,10 @@ int StackSizeHWMReset(void)
|
|||||||
ssize_t HWM = StackSizeHWM_OffsetCorrected(); \
|
ssize_t HWM = StackSizeHWM_OffsetCorrected(); \
|
||||||
int _ret; \
|
int _ret; \
|
||||||
__VA_ARGS__; \
|
__VA_ARGS__; \
|
||||||
printf(" relative stack peak usage = %ld bytes\n", HWM); \
|
printf(" relative stack peak usage = %ld bytes\n", (long int)HWM); \
|
||||||
_ret = StackSizeHWMReset(); \
|
_ret = StackSizeHWMReset(); \
|
||||||
if ((max >= 0) && (HWM > (ssize_t)(max))) { \
|
if ((max >= 0) && (HWM > (ssize_t)(max))) { \
|
||||||
printf(" relative stack usage at %s L%d exceeds designated max %ld bytes.\n", __FILE__, __LINE__, (ssize_t)(max)); \
|
printf(" relative stack usage at %s L%d exceeds designated max %ld bytes.\n", __FILE__, __LINE__, (long int)(max)); \
|
||||||
_ret = -1; \
|
_ret = -1; \
|
||||||
} \
|
} \
|
||||||
_ret; \
|
_ret; \
|
||||||
|
Reference in New Issue
Block a user