Skip to content

Commit 401a64d

Browse files
committed
Improve stdarg.h around uses of var_arg. Cleanup warning for XFREE/XMALLOC redef.
1 parent 942c3a0 commit 401a64d

7 files changed

Lines changed: 21 additions & 11 deletions

File tree

IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* along with this program; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2020
*/
21+
22+
#include <stdarg.h>
2123
#include "SEGGER_RTT.h"
2224

2325
#define SEGGER_INDEX (0)

IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <stdio.h>
2525
#include <string.h>
26+
#include <stdarg.h> /* var_arg */
2627
#include <sys/time.h>
2728
#include "wolfssl/wolfcrypt/settings.h"
2829
#include "wolfssl/ssl.h"

IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_demo.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
#include <stdio.h>
2424
#include <string.h>
2525
#include <stdlib.h>
26-
27-
28-
26+
#include <stdarg.h>
2927

3028
#include <wolfssl/wolfcrypt/settings.h>
3129
#include "wolfssl/ssl.h"

wolfcrypt/benchmark/benchmark.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@
476476
#endif
477477
#elif defined(WOLFSSL_ZEPHYR)
478478
#include <stdio.h>
479+
#include <stdarg.h>
479480
#define BENCH_EMBEDDED
480481
#define printf printfk
481482
static int printfk(const char *fmt, ...)

wolfssl/ssl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3051,15 +3051,18 @@ WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_set_peer_cert_chain(WOLFSSL* ss
30513051
WOLFSSL_API int wolfSSL_want_read(WOLFSSL* ssl);
30523052
WOLFSSL_API int wolfSSL_want_write(WOLFSSL* ssl);
30533053

3054-
#include <stdarg.h> /* var_arg */
3054+
30553055
#ifdef OPENSSL_EXTRA
30563056
WOLFSSL_API int wolfSSL_want(WOLFSSL* ssl);
30573057

30583058
WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_CTX_get0_privatekey(const WOLFSSL_CTX* ctx);
30593059

3060+
#include <stdarg.h> /* var_arg */
30603061
WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format,
30613062
va_list args);
30623063
WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO* bio, const char* format, ...);
3064+
3065+
30633066
WOLFSSL_API int wolfSSL_BIO_dump(WOLFSSL_BIO *bio, const char* buf, int length);
30643067
WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO* bio,
30653068
const WOLFSSL_ASN1_UTCTIME* a);

wolfssl/wolfcrypt/settings.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,12 @@ extern void uITRON4_free(void *p) ;
15201520
#ifdef FREERTOS_TCP
15211521
#if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \
15221522
!defined(WOLFSSL_STATIC_MEMORY)
1523-
#define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */
1524-
#define XFREE(p, h, type) vPortFree((p)) /* native heap */
1523+
#ifndef XMALLOC
1524+
#define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */
1525+
#endif
1526+
#ifndef XFREE
1527+
#define XFREE(p, h, type) vPortFree((p)) /* native heap */
1528+
#endif
15251529
#endif
15261530

15271531
#define WOLFSSL_GENSEED_FORTEST

wolfssl/wolfcrypt/types.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ typedef struct w64wrapper {
768768
#ifndef USE_WINDOWS_API
769769
#if defined(WOLFSSL_ESPIDF) && \
770770
(!defined(NO_ASN_TIME) && defined(HAVE_PKCS7))
771-
#include<stdarg.h>
771+
#include <stdarg.h>
772772
/* later gcc than 7.1 introduces -Wformat-truncation */
773773
/* In cases when truncation is expected the caller needs*/
774774
/* to check the return value from the function so that */
@@ -819,17 +819,18 @@ typedef struct w64wrapper {
819819
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
820820
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
821821
/* Beginning with the UCRT in Visual Studio 2015 and
822-
Windows 10, snprintf is no longer identical to
823-
_snprintf. The snprintf function behavior is now
824-
C99 standard compliant. */
822+
* Windows 10, snprintf is no longer identical to
823+
* _snprintf. The snprintf function behavior is now
824+
* C99 standard compliant. */
825825
#include <stdio.h>
826826
#define XSNPRINTF snprintf
827827
#else
828828
/* 4996 warning to use MS extensions e.g., _sprintf_s
829-
instead of _snprintf */
829+
* instead of _snprintf */
830830
#if !defined(__MINGW32__)
831831
#pragma warning(disable: 4996)
832832
#endif
833+
#include <stdarg.h>
833834
static WC_INLINE
834835
int xsnprintf(char *buffer, size_t bufsize,
835836
const char *format, ...) {

0 commit comments

Comments
 (0)