Skip to content

Commit 6b1052d

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. PR-URL: #37334 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 38afa3f commit 6b1052d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/base64-inl.h

+8
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,
@@ -50,6 +55,9 @@ bool base64_decode_group_slow(char* const dst, const size_t dstlen,
5055
return true; // Continue decoding.
5156
}
5257

58+
#ifdef _MSC_VER
59+
#pragma warning(pop)
60+
#endif
5361

5462
template <typename TypeName>
5563
size_t base64_decode_fast(char* const dst, const size_t dstlen,

src/node_revert.h

+10
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)