From bcb7172037486769744536e951e983086e05b3aa Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 11 May 2014 10:52:07 -0600 Subject: [PATCH] Enable MSVC warning for thread safety with statics Clean up a couple of additional issues found while playing with /Wall in MSVC. --- CMakeLists.txt | 2 +- include/chaiscript/dispatchkit/bootstrap_stl.hpp | 2 +- include/chaiscript/dispatchkit/boxed_number.hpp | 7 +++++-- include/chaiscript/language/chaiscript_parser.hpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d979f28..2d244540 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ else() endif() if(MSVC) - add_definitions(/W4) + add_definitions(/W4 /w44640) add_definitions(/bigobj) # Note on MSVC compiler flags. # The code base selective disables warnings as necessary when the compiler is complaining too much diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index 13b778a9..35929313 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -541,7 +541,7 @@ namespace chaiscript m->add(fun( std::function( [](const String *s) { return s->c_str(); } ) ), "c_str"); m->add(fun( std::function( [](const String *s) { return s->data(); } ) ), "data"); - m->add(fun( std::function( [](const String *s, int pos, int len) { return s->substr(pos, len); } ) ), "substr"); + m->add(fun( std::function( [](const String *s, size_t pos, size_t len) { return s->substr(pos, len); } ) ), "substr"); return m; } diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 92fda880..adb21c2a 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -14,10 +14,13 @@ namespace chaiscript { - + +// Due to the nature of generating every possible arithmetic operation, there +// are going to be warnings generated on every platform regarding size and sign, +// this is OK, so we're disabling size/and sign type warnings #ifdef CHAISCRIPT_MSVC #pragma warning(push) -#pragma warning(disable : 4244 4018 4389 4146) +#pragma warning(disable : 4244 4018 4389 4146 4365) #endif /// \brief Represents any numeric type, generically. Used internally for generic operations between POD values diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index 71334d55..8acd6412 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -194,7 +194,7 @@ namespace chaiscript /** * test a char in an m_alphabet */ - bool char_in_alphabet(unsigned char c, detail::Alphabet a) { return m_alphabet[a][c]; } + bool char_in_alphabet(char c, detail::Alphabet a) { return m_alphabet[a][c]; } /** * Prints the parsed ast_nodes as a tree