Skip to content

Commit 4d309cc

Browse files
committed
src: disable unfixable MSVC warnings
The following warnings are disabled: - C4065 in node_revert.h: there are no security reversions on the master branch. - C4003 in base64-inl.h: a macro is used four times, only once without parameters.
1 parent c405c2e commit 4d309cc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/base64-inl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ inline uint32_t ReadUint32BE(const unsigned char* p) {
2323
static_cast<uint32_t>(p[3]);
2424
}
2525

26+
#ifdef _MSC_VER
27+
#pragma warning( push )
28+
// MSVC C4003: not enough actual parameters for macro 'identifier'
29+
#pragma warning( disable : 4003 )
30+
#endif
2631

2732
template <typename TypeName>
2833
bool base64_decode_group_slow(char* const dst, const size_t dstlen,
@@ -54,6 +59,9 @@ bool base64_decode_group_slow(char* const dst, const size_t dstlen,
5459
return true; // Continue decoding.
5560
}
5661

62+
#ifdef _MSC_VER
63+
#pragma warning( pop )
64+
#endif
5765

5866
template <typename TypeName>
5967
size_t base64_decode_fast(char* const dst, const size_t dstlen,

src/node_revert.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ namespace per_process {
2828
extern unsigned int reverted_cve;
2929
}
3030

31+
#ifdef _MSC_VER
32+
#pragma warning( push )
33+
// MSVC C4065: switch statement contains 'default' but no 'case' labels
34+
#pragma warning( disable : 4065 )
35+
#endif
36+
3137
inline const char* RevertMessage(const reversion cve) {
3238
#define V(code, label, msg) case SECURITY_REVERT_##code: return label ": " msg;
3339
switch (cve) {
@@ -38,6 +44,10 @@ inline const char* RevertMessage(const reversion cve) {
3844
#undef V
3945
}
4046

47+
#ifdef _MSC_VER
48+
#pragma warning( pop )
49+
#endif
50+
4151
inline void Revert(const reversion cve) {
4252
per_process::reverted_cve |= 1 << cve;
4353
printf("SECURITY WARNING: Reverting %s\n", RevertMessage(cve));

0 commit comments

Comments
 (0)