Skip to content

Disable msvc warnings in source files #1111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,6 @@ 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(/wd4456) # Hides previous local declaration
xcheck_add_c_compiler_flag(/wd4457) # Hides function parameter
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()

# Set a 8MB default stack size on Windows.
Expand Down
20 changes: 20 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@
#include <fenv.h>
#include <math.h>

#ifdef _MSC_VER
#pragma warning(disable: 4018) // -Wno-sign-conversion
#pragma warning(disable: 4061) // -Wno-implicit-fallthrough
#pragma warning(disable: 4100) // -Wno-unused-parameter
#pragma warning(disable: 4200) // -Wno-zero-length-array
#pragma warning(disable: 4242) // -Wno-shorten-64-to-32
#pragma warning(disable: 4244) // -Wno-shorten-64-to-32
#pragma warning(disable: 4245) // -Wno-sign-compare
#pragma warning(disable: 4267) // -Wno-shorten-64-to-32
#pragma warning(disable: 4388) // -Wno-sign-compare
#pragma warning(disable: 4389) // -Wno-sign-compare
#pragma warning(disable: 4456) // Hides previous local declaration
#pragma warning(disable: 4457) // Hides function parameter
#pragma warning(disable: 4710) // Function not inlined
#pragma warning(disable: 4711) // Function was inlined
#pragma warning(disable: 4820) // Padding added after construct
#pragma warning(disable: 4996) // -Wdeprecated-declarations
#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#endif

#include "cutils.h"
#include "list.h"
#include "quickjs.h"
Expand Down