Skip to content

Commit a60f133

Browse files
authored
suppress msvc warnings about totally safe functions (#298)
1 parent 5164ec6 commit a60f133

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ endfunction()
1515

1616
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
1717
add_compile_options(-Wall -Wextra -pedantic -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wshadow -Wundef -Wold-style-cast -Wno-multichar)
18+
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
19+
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
1820
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1921
add_compile_options(-Weverything)
2022
# no need for c++98 compatibility

simplecpp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
#define nullptr NULL
4545
#endif
4646

47+
#if defined(_MSC_VER)
48+
// suppress warnings about "conversion from 'type1' to 'type2', possible loss of data"
49+
# pragma warning(disable : 4267)
50+
# pragma warning(disable : 4244)
51+
#endif
52+
4753
namespace simplecpp {
4854

4955
typedef std::string TokenString;

0 commit comments

Comments
 (0)