Skip to content

Commit 8065ba1

Browse files
Merge pull request #6620 from douzzer/20230714-WC_DO_NOTHING
20230714-WC_DO_NOTHING
2 parents fd13d37 + f6f8d2e commit 8065ba1

51 files changed

Lines changed: 203 additions & 195 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*----------------------------------------------------------------------------*/
3333
#include "stm32f2xx.h"
3434

35-
#define assert_param(a)
35+
#define assert_param(a) /* null expansion */
3636

3737
#define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
3838
#define SYNCHRO_TIMEOUT ((uint32_t) 0x00008000)

linuxkm/module_hooks.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,11 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) {
508508

509509
#include <wolfssl/wolfcrypt/coding.h>
510510

511-
PRAGMA_GCC_DIAG_PUSH;
512-
PRAGMA_GCC("GCC diagnostic ignored \"-Wnested-externs\"");
513-
PRAGMA_GCC("GCC diagnostic ignored \"-Wpointer-arith\"");
511+
PRAGMA_GCC_DIAG_PUSH
512+
PRAGMA_GCC("GCC diagnostic ignored \"-Wnested-externs\"")
513+
PRAGMA_GCC("GCC diagnostic ignored \"-Wpointer-arith\"")
514514
#include <crypto/hash.h>
515-
PRAGMA_GCC_DIAG_POP;
515+
PRAGMA_GCC_DIAG_POP
516516

517517
extern char verifyCore[WC_SHA256_DIGEST_SIZE*2 + 1];
518518
extern const char coreKey[WC_SHA256_DIGEST_SIZE*2 + 1];

src/crl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ static int StopMonitor(wolfSSL_CRL_mfd_t mfd)
13571357
LocalFree(lpMsgBuf); \
13581358
} while(0)
13591359
#else
1360-
#define SHOW_WINDOWS_ERROR()
1360+
#define SHOW_WINDOWS_ERROR() WC_DO_NOTHING
13611361
#endif
13621362

13631363
#define DM_ERROR() do { \

src/internal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24483,18 +24483,18 @@ void SetErrorString(int error, char* str)
2448324483
#ifndef NO_ERROR_STRINGS
2448424484
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
2448524485
#define SUITE_INFO(x,y,z,w,v,u) {(x),(y),(z),(w),(v),(u),WOLFSSL_CIPHER_SUITE_FLAG_NONE}
24486-
#define SUITE_ALIAS(x,z,w,v,u)
24486+
#define SUITE_ALIAS(x,z,w,v,u) /* null expansion */
2448724487
#else
2448824488
#define SUITE_INFO(x,y,z,w,v,u) {(x),(y),(z),(w),WOLFSSL_CIPHER_SUITE_FLAG_NONE}
24489-
#define SUITE_ALIAS(x,z,w,v,u)
24489+
#define SUITE_ALIAS(x,z,w,v,u) /* null expansion */
2449024490
#endif
2449124491
#else
2449224492
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
2449324493
#define SUITE_INFO(x,y,z,w,v,u) {(x),(z),(w),(v),(u),WOLFSSL_CIPHER_SUITE_FLAG_NONE}
24494-
#define SUITE_ALIAS(x,z,w,v,u)
24494+
#define SUITE_ALIAS(x,z,w,v,u) /* null expansion */
2449524495
#else
2449624496
#define SUITE_INFO(x,y,z,w,v,u) {(x),(z),(w),WOLFSSL_CIPHER_SUITE_FLAG_NONE}
24497-
#define SUITE_ALIAS(x,z,w,v,u)
24497+
#define SUITE_ALIAS(x,z,w,v,u) /* null expansion */
2449824498
#endif
2449924499
#endif
2450024500
#else /* !NO_CIPHER_SUITE_ALIASES */

src/sniffer.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,8 @@ static void UpdateMissedDataSessions(void)
619619

620620
#ifdef WOLFSSL_SNIFFER_STATS
621621
#ifdef HAVE_C___ATOMIC
622-
#define LOCK_STAT()
623-
#define UNLOCK_STAT()
622+
#define LOCK_STAT() WC_DO_NOTHING
623+
#define UNLOCK_STAT() WC_DO_NOTHING
624624
#define NOLOCK_ADD_TO_STAT(x,y) ({ TraceStat(#x, y); \
625625
__atomic_fetch_add(&x, y, __ATOMIC_RELAXED); })
626626
#else
@@ -636,10 +636,10 @@ static void UpdateMissedDataSessions(void)
636636
#endif /* WOLFSSL_SNIFFER_STATS */
637637

638638
#ifdef HAVE_C___ATOMIC
639-
#define LOCK_SESSION()
640-
#define UNLOCK_SESSION()
641-
#define LOCK_SERVER_LIST()
642-
#define UNLOCK_SERVER_LIST()
639+
#define LOCK_SESSION() WC_DO_NOTHING
640+
#define UNLOCK_SESSION() WC_DO_NOTHING
641+
#define LOCK_SERVER_LIST() WC_DO_NOTHING
642+
#define UNLOCK_SERVER_LIST() WC_DO_NOTHING
643643
#else
644644
#define LOCK_SESSION() wc_LockMutex(&SessionMutex)
645645
#define UNLOCK_SESSION() wc_UnLockMutex(&SessionMutex)

src/ssl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14963,10 +14963,10 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
1496314963
/* myBuffer may not be initialized fully, but the span up to the
1496414964
* sending length will be.
1496514965
*/
14966-
PRAGMA_GCC_DIAG_PUSH;
14967-
PRAGMA_GCC("GCC diagnostic ignored \"-Wmaybe-uninitialized\"");
14966+
PRAGMA_GCC_DIAG_PUSH
14967+
PRAGMA_GCC("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1496814968
ret = wolfSSL_write(ssl, myBuffer, sending);
14969-
PRAGMA_GCC_DIAG_POP;
14969+
PRAGMA_GCC_DIAG_POP
1497014970

1497114971
if (dynamic)
1497214972
XFREE(myBuffer, ssl->heap, DYNAMIC_TYPE_WRITEV);
@@ -26693,8 +26693,8 @@ WOLFSSL_EVP_PKEY *wolfSSL_PEM_read_PUBKEY(XFILE fp, WOLFSSL_EVP_PKEY **key,
2669326693

2669426694
WOLFSSL_ENTER("wolfSSL_PEM_read_PUBKEY");
2669526695

26696-
if (pem_read_file_key(fp, cb, pass, PUBLICKEY_TYPE, &keyFormat, &der)
26697-
>= 0) {
26696+
if ((pem_read_file_key(fp, cb, pass, PUBLICKEY_TYPE, &keyFormat, &der)
26697+
>= 0) && (der != NULL)) {
2669826698
const unsigned char* ptr = der->buffer;
2669926699

2670026700
/* handle case where reuse is attempted */

src/tls.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
18871887

18881888
#else /* HAVE_ALPN */
18891889

1890-
#define ALPN_FREE_ALL(list, heap)
1890+
#define ALPN_FREE_ALL(list, heap) WC_DO_NOTHING
18911891
#define ALPN_GET_SIZE(list) 0
18921892
#define ALPN_WRITE(a, b) 0
18931893
#define ALPN_PARSE(a, b, c, d) 0
@@ -2504,7 +2504,7 @@ int TLSX_SNI_GetFromBuffer(const byte* clientHello, word32 helloSz,
25042504

25052505
#else
25062506

2507-
#define SNI_FREE_ALL(list, heap)
2507+
#define SNI_FREE_ALL(list, heap) WC_DO_NOTHING
25082508
#define SNI_GET_SIZE(list) 0
25092509
#define SNI_WRITE(a, b) 0
25102510
#define SNI_PARSE(a, b, c, d) 0
@@ -2844,7 +2844,7 @@ int TLSX_UseTrustedCA(TLSX** extensions, byte type,
28442844

28452845
#else /* HAVE_TRUSTED_CA */
28462846

2847-
#define TCA_FREE_ALL(list, heap)
2847+
#define TCA_FREE_ALL(list, heap) WC_DO_NOTHING
28482848
#define TCA_GET_SIZE(list) 0
28492849
#define TCA_WRITE(a, b) 0
28502850
#define TCA_PARSE(a, b, c, d) 0
@@ -2938,7 +2938,7 @@ int TLSX_UseMaxFragment(TLSX** extensions, byte mfl, void* heap)
29382938

29392939
#else
29402940

2941-
#define MFL_FREE_ALL(a, b)
2941+
#define MFL_FREE_ALL(a, b) WC_DO_NOTHING
29422942
#define MFL_GET_SIZE(a) 0
29432943
#define MFL_WRITE(a, b) 0
29442944
#define MFL_PARSE(a, b, c, d) 0
@@ -3445,7 +3445,7 @@ int TLSX_UseCertificateStatusRequest(TLSX** extensions, byte status_type,
34453445

34463446
#else
34473447

3448-
#define CSR_FREE_ALL(data, heap)
3448+
#define CSR_FREE_ALL(data, heap) WC_DO_NOTHING
34493449
#define CSR_GET_SIZE(a, b) 0
34503450
#define CSR_WRITE(a, b, c) 0
34513451
#define CSR_PARSE(a, b, c, d) 0
@@ -3891,7 +3891,7 @@ int TLSX_UseCertificateStatusRequestV2(TLSX** extensions, byte status_type,
38913891

38923892
#else
38933893

3894-
#define CSR2_FREE_ALL(data, heap)
3894+
#define CSR2_FREE_ALL(data, heap) WC_DO_NOTHING
38953895
#define CSR2_GET_SIZE(a, b) 0
38963896
#define CSR2_WRITE(a, b, c) 0
38973897
#define CSR2_PARSE(a, b, c, d) 0
@@ -5113,18 +5113,18 @@ int TLSX_UsePointFormat(TLSX** extensions, byte format, void* heap)
51135113

51145114
#else
51155115

5116-
#define EC_FREE_ALL(list, heap)
5116+
#define EC_FREE_ALL(list, heap) WC_DO_NOTHING
51175117
#define EC_GET_SIZE(list) 0
51185118
#define EC_WRITE(a, b) 0
51195119
#define EC_PARSE(a, b, c, d, e) 0
5120-
#define EC_VALIDATE_REQUEST(a, b)
5120+
#define EC_VALIDATE_REQUEST(a, b) WC_DO_NOTHING
51215121

5122-
#define PF_FREE_ALL(list, heap)
5122+
#define PF_FREE_ALL(list, heap) WC_DO_NOTHING
51235123
#define PF_GET_SIZE(list) 0
51245124
#define PF_WRITE(a, b) 0
51255125
#define PF_PARSE(a, b, c, d) 0
5126-
#define PF_VALIDATE_REQUEST(a, b)
5127-
#define PF_VALIDATE_RESPONSE(a, b)
5126+
#define PF_VALIDATE_REQUEST(a, b) WC_DO_NOTHING
5127+
#define PF_VALIDATE_RESPONSE(a, b) WC_DO_NOTHING
51285128

51295129
#endif /* HAVE_SUPPORTED_CURVES */
51305130

@@ -5319,7 +5319,7 @@ int TLSX_AddEmptyRenegotiationInfo(TLSX** extensions, void* heap)
53195319

53205320
#else
53215321

5322-
#define SCR_FREE_ALL(a, heap)
5322+
#define SCR_FREE_ALL(a, heap) WC_DO_NOTHING
53235323
#define SCR_GET_SIZE(a, b) 0
53245324
#define SCR_WRITE(a, b, c) 0
53255325
#define SCR_PARSE(a, b, c, d) 0
@@ -5525,8 +5525,8 @@ int TLSX_UseSessionTicket(TLSX** extensions, SessionTicket* ticket, void* heap)
55255525

55265526
#else
55275527

5528-
#define WOLF_STK_FREE(a, b)
5529-
#define WOLF_STK_VALIDATE_REQUEST(a)
5528+
#define WOLF_STK_FREE(a, b) WC_DO_NOTHING
5529+
#define WOLF_STK_VALIDATE_REQUEST(a) WC_DO_NOTHING
55305530
#define WOLF_STK_GET_SIZE(a, b) 0
55315531
#define WOLF_STK_WRITE(a, b, c) 0
55325532
#define WOLF_STK_PARSE(a, b, c, d) 0
@@ -5882,7 +5882,7 @@ static int TLSX_UseSRTP(TLSX** extensions, word16 profiles, void* heap)
58825882
#define SRTP_WRITE TLSX_UseSRTP_Write
58835883
#define SRTP_GET_SIZE TLSX_UseSRTP_GetSize
58845884
#else
5885-
#define SRTP_FREE(a, b)
5885+
#define SRTP_FREE(a, b) WC_DO_NOTHING
58865886
#define SRTP_PARSE(a, b, c, d) 0
58875887
#define SRTP_WRITE(a, b) 0
58885888
#define SRTP_GET_SIZE(a) 0
@@ -9657,7 +9657,7 @@ int TLSX_KeyShare_DeriveSecret(WOLFSSL *ssl)
96579657

96589658
#else
96599659

9660-
#define KS_FREE_ALL(a, b)
9660+
#define KS_FREE_ALL(a, b) WC_DO_NOTHING
96619661
#define KS_GET_SIZE(a, b) 0
96629662
#define KS_WRITE(a, b, c) 0
96639663
#define KS_PARSE(a, b, c, d) 0
@@ -10167,7 +10167,7 @@ int TLSX_PreSharedKey_Use(TLSX** extensions, const byte* identity, word16 len,
1016710167

1016810168
#else
1016910169

10170-
#define PSK_FREE_ALL(a, b)
10170+
#define PSK_FREE_ALL(a, b) WC_DO_NOTHING
1017110171
#define PSK_GET_SIZE(a, b, c) 0
1017210172
#define PSK_WRITE(a, b, c, d) 0
1017310173
#define PSK_PARSE(a, b, c, d) 0

src/tls13.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ static int Tls13HKDFExpandKeyLabel(WOLFSSL* ssl, byte* okm, word32 okmLen,
262262
/* hash buffer may not be fully initialized, but the sending length won't
263263
* extend beyond the initialized span.
264264
*/
265-
PRAGMA_GCC_DIAG_PUSH;
266-
PRAGMA_GCC("GCC diagnostic ignored \"-Wmaybe-uninitialized\"");
265+
PRAGMA_GCC_DIAG_PUSH
266+
PRAGMA_GCC("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
267267
(void)ssl;
268268
(void)side;
269269
return wc_Tls13_HKDF_Expand_Label(okm, okmLen, prk, prkLen,
270270
protocol, protocolLen,
271271
label, labelLen,
272272
info, infoLen, digest);
273-
PRAGMA_GCC_DIAG_POP;
273+
PRAGMA_GCC_DIAG_POP
274274
}
275275
#endif /* !HAVE_FIPS || !wc_Tls13_HKDF_Expand_Label */
276276

@@ -476,8 +476,8 @@ int Tls13DeriveKey(WOLFSSL* ssl, byte* output, int outputLen,
476476
/* hash buffer may not be fully initialized, but the sending length won't
477477
* extend beyond the initialized span.
478478
*/
479-
PRAGMA_GCC_DIAG_PUSH;
480-
PRAGMA_GCC("GCC diagnostic ignored \"-Wmaybe-uninitialized\"");
479+
PRAGMA_GCC_DIAG_PUSH
480+
PRAGMA_GCC("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
481481
PRIVATE_KEY_UNLOCK();
482482
#if defined(HAVE_FIPS) && defined(wc_Tls13_HKDF_Expand_Label)
483483
(void)side;
@@ -495,7 +495,7 @@ int Tls13DeriveKey(WOLFSSL* ssl, byte* output, int outputLen,
495495
wc_MemZero_Add("TLS 1.3 derived key", output, outputLen);
496496
#endif
497497
return ret;
498-
PRAGMA_GCC_DIAG_POP;
498+
PRAGMA_GCC_DIAG_POP
499499
}
500500

501501
/* Convert TLS mac ID to a hash algorithm ID

tests/api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,8 +2189,8 @@ void DEBUG_WRITE_DER(const byte* der, int derSz, const char* fileName)
21892189
}
21902190
}
21912191
#else
2192-
#define DEBUG_WRITE_CERT_X509(x509, fileName)
2193-
#define DEBUG_WRITE_DER(der, derSz, fileName)
2192+
#define DEBUG_WRITE_CERT_X509(x509, fileName) WC_DO_NOTHING
2193+
#define DEBUG_WRITE_DER(der, derSz, fileName) WC_DO_NOTHING
21942194
#endif
21952195

21962196

tests/unit.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <wolfssl/test.h> /* thread and tcp stuff */
2828

2929
#ifdef WOLFSSL_FORCE_MALLOC_FAIL_TEST
30-
#define XABORT()
30+
#define XABORT() WC_DO_NOTHING
3131
#else
3232
#define XABORT() abort()
3333
#endif
@@ -99,17 +99,17 @@
9999
#else
100100

101101
#define AssertPtr(x, y, op, er) do { \
102-
PRAGMA_GCC_DIAG_PUSH; \
102+
PRAGMA_GCC_DIAG_PUSH \
103103
/* remarkably, without this inhibition, */ \
104104
/* the _Pragma()s make the declarations warn. */ \
105-
PRAGMA_GCC("GCC diagnostic ignored \"-Wdeclaration-after-statement\""); \
105+
PRAGMA_GCC("GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
106106
/* inhibit "ISO C forbids conversion of function pointer */ \
107107
/* to object pointer type [-Werror=pedantic]" */ \
108-
PRAGMA_GCC("GCC diagnostic ignored \"-Wpedantic\""); \
108+
PRAGMA_GCC("GCC diagnostic ignored \"-Wpedantic\"") \
109109
void* _x = (void*)(x); \
110110
void* _y = (void*)(y); \
111111
Assert(_x op _y, ("%s " #op " %s", #x, #y), ("%p " #er " %p", _x, _y)); \
112-
PRAGMA_GCC_DIAG_POP; \
112+
PRAGMA_GCC_DIAG_POP \
113113
} while(0)
114114

115115
#endif
@@ -189,17 +189,17 @@
189189

190190
#define ExpectPtr(x, y, op, er) do { \
191191
if (_ret != TEST_FAIL) { \
192-
PRAGMA_DIAG_PUSH; \
192+
PRAGMA_DIAG_PUSH \
193193
/* remarkably, without this inhibition, */ \
194194
/* the _Pragma()s make the declarations warn. */ \
195-
PRAGMA("GCC diagnostic ignored \"-Wdeclaration-after-statement\""); \
195+
PRAGMA("GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
196196
/* inhibit "ISO C forbids conversion of function pointer */ \
197197
/* to object pointer type [-Werror=pedantic]" */ \
198-
PRAGMA("GCC diagnostic ignored \"-Wpedantic\""); \
198+
PRAGMA("GCC diagnostic ignored \"-Wpedantic\"") \
199199
void* _x = (void*)(x); \
200200
void* _y = (void*)(y); \
201201
Expect(_x op _y, ("%s " #op " %s", #x, #y), ("%p " #er " %p", _x, _y));\
202-
PRAGMA_DIAG_POP; \
202+
PRAGMA_DIAG_POP \
203203
} \
204204
} while(0)
205205

@@ -261,17 +261,17 @@
261261
#define DoExpectStrLE(x, y) DoExpectStr(x, y, <=, >)
262262

263263
#define DoExpectPtr(x, y, op, er) do { \
264-
PRAGMA_DIAG_PUSH; \
264+
PRAGMA_DIAG_PUSH \
265265
/* remarkably, without this inhibition, */ \
266266
/* the _Pragma()s make the declarations warn. */ \
267-
PRAGMA("GCC diagnostic ignored \"-Wdeclaration-after-statement\""); \
267+
PRAGMA("GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
268268
/* inhibit "ISO C forbids conversion of function pointer */ \
269269
/* to object pointer type [-Werror=pedantic]" */ \
270-
PRAGMA("GCC diagnostic ignored \"-Wpedantic\""); \
270+
PRAGMA("GCC diagnostic ignored \"-Wpedantic\"") \
271271
void* _x = (void*)(x); \
272272
void* _y = (void*)(y); \
273273
Expect(_x op _y, ("%s " #op " %s", #x, #y), ("%p " #er " %p", _x, _y)); \
274-
PRAGMA_DIAG_POP; \
274+
PRAGMA_DIAG_POP \
275275
} while(0)
276276

277277
#define DoExpectPtrEq(x, y) DoExpectPtr(x, y, ==, !=)

0 commit comments

Comments
 (0)