Skip to content

Commit b1d1c51

Browse files
committed
Silence noisy (and useless) MSVC warnings
1 parent 5bf3545 commit b1d1c51

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ if(MSVC)
5151
xcheck_add_c_compiler_flag(-Wno-reserved-identifier)
5252
xcheck_add_c_compiler_flag(-Wdeprecated-declarations)
5353
xcheck_add_c_compiler_flag(/experimental:c11atomics)
54+
xcheck_add_c_compiler_flag(/wd4018)
55+
xcheck_add_c_compiler_flag(/wd4061)
56+
xcheck_add_c_compiler_flag(/wd4100)
57+
xcheck_add_c_compiler_flag(/wd4242)
58+
xcheck_add_c_compiler_flag(/wd4244)
59+
xcheck_add_c_compiler_flag(/wd4245)
60+
xcheck_add_c_compiler_flag(/wd4267)
61+
xcheck_add_c_compiler_flag(/wd4388)
62+
xcheck_add_c_compiler_flag(/wd4389)
63+
xcheck_add_c_compiler_flag(/wd4710)
64+
xcheck_add_c_compiler_flag(/wd4711)
65+
xcheck_add_c_compiler_flag(/wd4820)
66+
xcheck_add_c_compiler_flag(/wd5045)
5467
endif()
5568

5669
# MacOS and GCC 11 or later need -Wno-maybe-uninitialized

cutils.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
#undef NANOSEC
3838
#define NANOSEC ((uint64_t) 1e9)
3939

40+
#ifdef __GNUC__
4041
#pragma GCC visibility push(default)
42+
#endif
4143

4244
void pstrcpy(char *buf, int buf_size, const char *str)
4345
{
@@ -1404,4 +1406,6 @@ int js_cond_timedwait(js_cond_t *cond, js_mutex_t *mutex, uint64_t timeout) {
14041406

14051407
#endif /* !defined(EMSCRIPTEN) && !defined(__wasi__) */
14061408

1409+
#ifdef __GNUC__
14071410
#pragma GCC visibility pop
1411+
#endif

quickjs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34050,7 +34050,9 @@ typedef struct BCReaderState {
3405034050
} BCReaderState;
3405134051

3405234052
#ifdef DUMP_READ_OBJECT
34053+
#ifdef __GNUC__
3405334054
#pragma GCC diagnostic ignored "-Wformat-zero-length"
34055+
#endif
3405434056
static void __attribute__((format(printf, 2, 3))) bc_read_trace(BCReaderState *s, const char *fmt, ...) {
3405534057
va_list ap;
3405634058
int i, n, n0;
@@ -34084,7 +34086,9 @@ static void __attribute__((format(printf, 2, 3))) bc_read_trace(BCReaderState *s
3408434086
if (strchr(fmt, '{'))
3408534087
s->level++;
3408634088
}
34089+
#ifdef __GNUC__
3408734090
#pragma GCC diagnostic warning "-Wformat-zero-length"
34091+
#endif
3408834092
#else
3408934093
#define bc_read_trace(...)
3409034094
#endif

0 commit comments

Comments
 (0)