Skip to content

Commit

Permalink
Fixed compiler warnings (new MSVC version)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Nov 17, 2023
1 parent aa11f73 commit a266da2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ if(NOT MSVC)
endif(NOT MSVC)

# This works both for MSVC and CL on Windows
if(WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
endif(WIN32)
# Recent version of MSVC toolset issues c++17 deprecation warning even if we use /std:c++11
if(MSVC)
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_DEPRECATE
_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
)
endif(MSVC)

# set a few other things at the top level to prevent incompatibilities
set(CMAKE_C_STANDARD 99)
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

/* do not use the statement for old MSVC versions */
#if (!defined(_MSVC_LANG) || _MSVC_LANG >= 201703L)
# define FALLTHROUGH_STATEMENT [[fallthrough]];
# define FALLTHROUGH_STATEMENT [[fallthrough]]
#else
# define FALLTHROUGH_STATEMENT
#endif
#endif

0 comments on commit a266da2

Please sign in to comment.