diff --git a/CMakeLists.txt b/CMakeLists.txt index df1295f..31ea72f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,21 @@ if(MSVC) xcheck_add_c_compiler_flag(-Wno-reserved-identifier) xcheck_add_c_compiler_flag(-Wdeprecated-declarations) xcheck_add_c_compiler_flag(/experimental:c11atomics) + xcheck_add_c_compiler_flag(/wd4018) # -Wno-sign-conversion + xcheck_add_c_compiler_flag(/wd4061) # -Wno-implicit-fallthrough + xcheck_add_c_compiler_flag(/wd4100) # -Wno-unused-parameter + xcheck_add_c_compiler_flag(/wd4200) # -Wno-zero-length-array + xcheck_add_c_compiler_flag(/wd4242) # -Wno-shorten-64-to-32 + xcheck_add_c_compiler_flag(/wd4244) # -Wno-shorten-64-to-32 + xcheck_add_c_compiler_flag(/wd4245) # -Wno-sign-compare + xcheck_add_c_compiler_flag(/wd4267) # -Wno-shorten-64-to-32 + xcheck_add_c_compiler_flag(/wd4388) # -Wno-sign-compare + xcheck_add_c_compiler_flag(/wd4389) # -Wno-sign-compare + xcheck_add_c_compiler_flag(/wd4710) # Function not inlined + xcheck_add_c_compiler_flag(/wd4711) # Function was inlined + xcheck_add_c_compiler_flag(/wd4820) # Padding added after construct + xcheck_add_c_compiler_flag(/wd4996) # -Wdeprecated-declarations + xcheck_add_c_compiler_flag(/wd5045) # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified endif() # MacOS and GCC 11 or later need -Wno-maybe-uninitialized diff --git a/cutils.c b/cutils.c index 396bc71..4d11481 100644 --- a/cutils.c +++ b/cutils.c @@ -37,7 +37,9 @@ #undef NANOSEC #define NANOSEC ((uint64_t) 1e9) +#ifdef __GNUC__ #pragma GCC visibility push(default) +#endif void pstrcpy(char *buf, int buf_size, const char *str) { @@ -1404,4 +1406,6 @@ int js_cond_timedwait(js_cond_t *cond, js_mutex_t *mutex, uint64_t timeout) { #endif /* !defined(EMSCRIPTEN) && !defined(__wasi__) */ +#ifdef __GNUC__ #pragma GCC visibility pop +#endif diff --git a/quickjs.c b/quickjs.c index 64b8bbe..e415b5b 100644 --- a/quickjs.c +++ b/quickjs.c @@ -67,6 +67,10 @@ #define CONFIG_ATOMICS #endif +#ifndef __GNUC__ +#define __extension__ +#endif + // Debug trace system: the debug output will be produced to the dump stream (currently // stdout) if qjs is invoked with -D with the corresponding bit set.