Skip to content

Commit 44db4f3

Browse files
committed
wolfssl/wolfcrypt/settings.h: add needed (void)s for unused args to several XMALLOC/XFREE/XREALLOC macros that were missing them.
1 parent 73ca6da commit 44db4f3

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

wolfssl/wolfcrypt/settings.h

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@
636636
#ifdef WOLFSSL_PICOTCP_DEMO
637637
#define WOLFSSL_STM32
638638
#define TFM_TIMING_RESISTANT
639-
#define XMALLOC(s, h, type) PICO_ZALLOC((s))
640-
#define XFREE(p, h, type) PICO_FREE((p))
639+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), PICO_ZALLOC((s)))
640+
#define XFREE(p, h, type) ((void)(h), (void)(type), PICO_FREE((p)))
641641
#define SINGLE_THREADED
642642
#define NO_WRITEV
643643
#define WOLFSSL_USER_IO
@@ -824,9 +824,9 @@ extern void *uITRON4_malloc(size_t sz) ;
824824
extern void *uITRON4_realloc(void *p, size_t sz) ;
825825
extern void uITRON4_free(void *p) ;
826826

827-
#define XMALLOC(sz, heap, type) uITRON4_malloc(sz)
828-
#define XREALLOC(p, sz, heap, type) uITRON4_realloc(p, sz)
829-
#define XFREE(p, heap, type) uITRON4_free(p)
827+
#define XMALLOC(sz, heap, type) ((void)(heap), (void)(type), uITRON4_malloc(sz))
828+
#define XREALLOC(p, sz, heap, type) ((void)(heap), (void)(type), uITRON4_realloc(p, sz))
829+
#define XFREE(p, heap, type) ((void)(heap), (void)(type), uITRON4_free(p))
830830
#endif
831831

832832
#if defined(WOLFSSL_uTKERNEL2)
@@ -836,9 +836,9 @@ extern void uITRON4_free(void *p) ;
836836
void* uTKernel_malloc(unsigned int sz);
837837
void* uTKernel_realloc(void *p, unsigned int sz);
838838
void uTKernel_free(void *p);
839-
#define XMALLOC(s, h, type) uTKernel_malloc((s))
840-
#define XREALLOC(p, n, h, t) uTKernel_realloc((p), (n))
841-
#define XFREE(p, h, type) uTKernel_free((p))
839+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), uTKernel_malloc((s)))
840+
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), uTKernel_realloc((p), (n)))
841+
#define XFREE(p, h, type) ((void)(h), (void)(type), uTKernel_free((p)))
842842
#endif
843843

844844
#ifndef NO_STDIO_FGETS_REMAP
@@ -868,9 +868,9 @@ extern void uITRON4_free(void *p) ;
868868
#if defined(WOLFSSL_LEANPSK) && !defined(XMALLOC_USER) && \
869869
!defined(NO_WOLFSSL_MEMORY)
870870
#include <stdlib.h>
871-
#define XMALLOC(s, h, type) malloc((s))
872-
#define XFREE(p, h, type) free((p))
873-
#define XREALLOC(p, n, h, t) realloc((p), (n))
871+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), malloc((s)))
872+
#define XFREE(p, h, type) ((void)(h), (void)(type), free((p)))
873+
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), realloc((p), (n)))
874874
#endif
875875

876876
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
@@ -889,16 +889,16 @@ extern void uITRON4_free(void *p) ;
889889

890890
#if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
891891
!defined(WOLFSSL_STATIC_MEMORY) && !defined(WOLFSSL_TRACK_MEMORY)
892-
#define XMALLOC(s, h, type) pvPortMalloc((s))
893-
#define XFREE(p, h, type) vPortFree((p))
892+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), pvPortMalloc((s)))
893+
#define XFREE(p, h, type) ((void)(h), (void)(type), vPortFree((p)))
894894
#if defined(WOLFSSL_ESPIDF)
895895
/* In IDF, realloc(p, n) is equivalent to
896896
* heap_caps_realloc(p, s, MALLOC_CAP_8BIT) */
897-
#define XREALLOC(p, n, h, t) realloc((p), (n))
897+
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), realloc((p), (n)))
898898
/* FreeRTOS pvPortRealloc() implementation can be found here:
899899
* https://github.com/wolfSSL/wolfssl-freertos/pull/3/files */
900900
#elif defined(USE_INTEGER_HEAP_MATH) || defined(OPENSSL_EXTRA)
901-
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
901+
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), pvPortRealloc((p), (n)))
902902
#endif
903903
#endif
904904

@@ -1018,9 +1018,9 @@ extern void uITRON4_free(void *p) ;
10181018
#define strtok_r strtok_s
10191019
#endif
10201020

1021-
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
1022-
#define XFREE(p, h, type) (rtp_free(p))
1023-
#define XREALLOC(p, n, h, t) (rtp_realloc((p), (n), (t)))
1021+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), ((void *)rtp_malloc((s), SSL_PRO_MALLOC)))
1022+
#define XFREE(p, h, type) ((void)(h), (void)(type), rtp_free(p))
1023+
#define XREALLOC(p, n, h, t) ((void)(h), rtp_realloc((p), (n), (t)))
10241024

10251025
#if (WINMSP3)
10261026
#define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
@@ -1080,14 +1080,14 @@ extern void uITRON4_free(void *p) ;
10801080
#endif
10811081
#if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
10821082
!defined(WOLFSSL_STATIC_MEMORY)
1083-
#define XMALLOC(s, h, type) pvPortMalloc((s))
1084-
#define XFREE(p, h, type) vPortFree((p))
1083+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), pvPortMalloc((s)))
1084+
#define XFREE(p, h, type) ((void)(h), (void)(type), vPortFree((p)))
10851085

10861086
/* FreeRTOS pvPortRealloc() implementation can be found here:
10871087
https://github.com/wolfSSL/wolfssl-freertos/pull/3/files */
10881088
#if !defined(USE_FAST_MATH) || defined(HAVE_ED25519) || \
10891089
defined(HAVE_ED448)
1090-
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
1090+
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), pvPortRealloc((p), (n)))
10911091
#endif
10921092
#endif
10931093
#endif
@@ -1143,8 +1143,8 @@ extern void uITRON4_free(void *p) ;
11431143

11441144
#if !defined(XMALLOC_OVERRIDE) && !defined(XMALLOC_USER)
11451145
#define XMALLOC_OVERRIDE
1146-
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
1147-
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
1146+
#define XMALLOC(s, h, t) ((void)(h), (void)(t), (void *)_mem_alloc_system((s)))
1147+
#define XFREE(p, h, t) {void* xp = (p); (void)(h); (void)(t); if ((xp)) _mem_free((xp));}
11481148
/* Note: MQX has no realloc, using fastmath above */
11491149
#endif
11501150
#ifdef USE_FAST_MATH
@@ -1174,8 +1174,8 @@ extern void uITRON4_free(void *p) ;
11741174
#include <mutex.h>
11751175
#endif
11761176

1177-
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
1178-
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
1177+
#define XMALLOC(s, h, t) ((void)(h), (void)(t), (void *)_mem_alloc_system((s)))
1178+
#define XFREE(p, h, t) {void* xp = (p); (void)(h); (void)(t); if ((xp)) _mem_free((xp));}
11791179
#define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
11801180

11811181
#define MQX_FILE_PTR FILE *
@@ -1188,8 +1188,8 @@ extern void uITRON4_free(void *p) ;
11881188
#define WOLFSSL_CRYPT_HW_MUTEX 1
11891189

11901190
#if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY)
1191-
#define XMALLOC(s, h, type) pvPortMalloc((s))
1192-
#define XFREE(p, h, type) vPortFree((p))
1191+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), pvPortMalloc((s)))
1192+
#define XFREE(p, h, type) ((void)(h), (void)(type), vPortFree((p)))
11931193
#endif
11941194

11951195
/* #define USER_TICKS */
@@ -1851,9 +1851,9 @@ extern void uITRON4_free(void *p) ;
18511851
#define NO_SESSION_CACHE
18521852
#define NO_ERROR_STRINGS
18531853
#define XMALLOC_USER
1854-
#define XMALLOC(sz, heap, type) os_malloc(sz)
1855-
#define XREALLOC(p, sz, heap, type) os_realloc(p, sz)
1856-
#define XFREE(p, heap, type) os_free(p)
1854+
#define XMALLOC(sz, heap, type) ((void)(heap), (void)(type), os_malloc(sz))
1855+
#define XREALLOC(p, sz, heap, type) ((void)(heap), (void)(type), os_realloc(p, sz))
1856+
#define XFREE(p, heap, type) ((void)(heap), (void)(type), os_free(p))
18571857

18581858
#endif /*(WOLFSSL_APACHE_MYNEWT)*/
18591859

@@ -1991,9 +1991,9 @@ extern void uITRON4_free(void *p) ;
19911991
#include "RTOS.h"
19921992
#if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) && \
19931993
!defined(WOLFSSL_STATIC_MEMORY)
1994-
#define XMALLOC(s, h, type) OS_HEAP_malloc((s))
1995-
#define XFREE(p, h, type) OS_HEAP_free((p))
1996-
#define XREALLOC(p, n, h, t) OS_HEAP_realloc(((p), (n))
1994+
#define XMALLOC(s, h, type) ((void)(h), (void)(type), OS_HEAP_malloc((s)))
1995+
#define XFREE(p, h, type) ((void)(h), (void)(type), OS_HEAP_free((p)))
1996+
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), OS_HEAP_realloc(((p), (n)))
19971997
#endif
19981998
#endif
19991999

0 commit comments

Comments
 (0)