Skip to content

Commit

Permalink
Improve stdarg.h around uses of var_arg. Cleanup warning for XFREE/XM…
Browse files Browse the repository at this point in the history
…ALLOC redef.
  • Loading branch information
dgarske committed Nov 22, 2024
1 parent 942c3a0 commit 401a64d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions IDE/Renesas/e2studio/RA6M4/test/src/SEGGER_RTT/myprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/

#include <stdarg.h>
#include "SEGGER_RTT.h"

#define SEGGER_INDEX (0)
Expand Down
1 change: 1 addition & 0 deletions IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <stdio.h>
#include <string.h>
#include <stdarg.h> /* var_arg */
#include <sys/time.h>
#include "wolfssl/wolfcrypt/settings.h"
#include "wolfssl/ssl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>



#include <stdarg.h>

#include <wolfssl/wolfcrypt/settings.h>
#include "wolfssl/ssl.h"
Expand Down
1 change: 1 addition & 0 deletions wolfcrypt/benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@
#endif
#elif defined(WOLFSSL_ZEPHYR)
#include <stdio.h>
#include <stdarg.h>
#define BENCH_EMBEDDED
#define printf printfk
static int printfk(const char *fmt, ...)
Expand Down
5 changes: 4 additions & 1 deletion wolfssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3051,15 +3051,18 @@ WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509)* wolfSSL_set_peer_cert_chain(WOLFSSL* ss
WOLFSSL_API int wolfSSL_want_read(WOLFSSL* ssl);
WOLFSSL_API int wolfSSL_want_write(WOLFSSL* ssl);

#include <stdarg.h> /* var_arg */

#ifdef OPENSSL_EXTRA
WOLFSSL_API int wolfSSL_want(WOLFSSL* ssl);

WOLFSSL_API WOLFSSL_EVP_PKEY* wolfSSL_CTX_get0_privatekey(const WOLFSSL_CTX* ctx);

#include <stdarg.h> /* var_arg */
WOLFSSL_API int wolfSSL_BIO_vprintf(WOLFSSL_BIO* bio, const char* format,
va_list args);
WOLFSSL_API int wolfSSL_BIO_printf(WOLFSSL_BIO* bio, const char* format, ...);


WOLFSSL_API int wolfSSL_BIO_dump(WOLFSSL_BIO *bio, const char* buf, int length);
WOLFSSL_API int wolfSSL_ASN1_UTCTIME_print(WOLFSSL_BIO* bio,
const WOLFSSL_ASN1_UTCTIME* a);
Expand Down
8 changes: 6 additions & 2 deletions wolfssl/wolfcrypt/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -1520,8 +1520,12 @@ extern void uITRON4_free(void *p) ;
#ifdef FREERTOS_TCP
#if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) && \
!defined(WOLFSSL_STATIC_MEMORY)
#define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */
#define XFREE(p, h, type) vPortFree((p)) /* native heap */
#ifndef XMALLOC
#define XMALLOC(s, h, type) pvPortMalloc((s)) /* native heap */
#endif
#ifndef XFREE
#define XFREE(p, h, type) vPortFree((p)) /* native heap */
#endif
#endif

#define WOLFSSL_GENSEED_FORTEST
Expand Down
11 changes: 6 additions & 5 deletions wolfssl/wolfcrypt/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ typedef struct w64wrapper {
#ifndef USE_WINDOWS_API
#if defined(WOLFSSL_ESPIDF) && \
(!defined(NO_ASN_TIME) && defined(HAVE_PKCS7))
#include<stdarg.h>
#include <stdarg.h>
/* later gcc than 7.1 introduces -Wformat-truncation */
/* In cases when truncation is expected the caller needs*/
/* to check the return value from the function so that */
Expand Down Expand Up @@ -819,17 +819,18 @@ typedef struct w64wrapper {
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
/* Beginning with the UCRT in Visual Studio 2015 and
Windows 10, snprintf is no longer identical to
_snprintf. The snprintf function behavior is now
C99 standard compliant. */
* Windows 10, snprintf is no longer identical to
* _snprintf. The snprintf function behavior is now
* C99 standard compliant. */
#include <stdio.h>
#define XSNPRINTF snprintf
#else
/* 4996 warning to use MS extensions e.g., _sprintf_s
instead of _snprintf */
* instead of _snprintf */
#if !defined(__MINGW32__)
#pragma warning(disable: 4996)
#endif
#include <stdarg.h>
static WC_INLINE
int xsnprintf(char *buffer, size_t bufsize,
const char *format, ...) {
Expand Down

0 comments on commit 401a64d

Please sign in to comment.