diff --git a/CMakeLists.txt b/CMakeLists.txt index 31452ba..61281cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,7 +158,7 @@ else() endif() if(MSVC) - add_definitions(/W4) + add_definitions(/W4 /w14545 /w34062 /w34242 /w34254 /w34287 /w44263 /w44265 /w44296 /w44311 /w44826 /we4289 /w14546 /w14547 /w14549 /w14555 /w14619 /w14905 /w14906 /w14928) # VS2013 doesn't have magic statics if (MSVC_VERSION STREQUAL "1800") diff --git a/include/chaiscript/chaiscript_defines.hpp b/include/chaiscript/chaiscript_defines.hpp index 1036a13..724185f 100644 --- a/include/chaiscript/chaiscript_defines.hpp +++ b/include/chaiscript/chaiscript_defines.hpp @@ -154,7 +154,8 @@ namespace chaiscript { } }; - for(char c = *t_str; (c = *t_str); ++t_str) { + for(; *t_str != '\0'; ++t_str) { + char c = *t_str; if (c == '.') { decimal_place = 10; } else if (c == 'e' || c == 'E') { diff --git a/include/chaiscript/dispatchkit/boxed_number.hpp b/include/chaiscript/dispatchkit/boxed_number.hpp index 8a784ec..05f5ad6 100644 --- a/include/chaiscript/dispatchkit/boxed_number.hpp +++ b/include/chaiscript/dispatchkit/boxed_number.hpp @@ -43,7 +43,7 @@ namespace chaiscript // 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 4365 4267) +#pragma warning(disable : 4244 4018 4389 4146 4365 4267 4242) #endif diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index c4d6b28..a272a07 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -591,14 +591,14 @@ namespace chaiscript } /// Adds a new scope to the stack - void new_scope(Stack_Holder &t_holder) + static void new_scope(Stack_Holder &t_holder) { get_stack_data(t_holder).emplace_back(); t_holder.call_params.emplace_back(); } /// Pops the current scope from the stack - void pop_scope(Stack_Holder &t_holder) + static void pop_scope(Stack_Holder &t_holder) { t_holder.call_params.pop_back(); StackData &stack = get_stack_data(t_holder); @@ -910,8 +910,8 @@ namespace chaiscript return m_conversions; } - bool is_attribute_call(const std::vector &t_funs, const std::vector &t_params, - bool t_has_params, const Type_Conversions_State &t_conversions) const + static bool is_attribute_call(const std::vector &t_funs, const std::vector &t_params, + bool t_has_params, const Type_Conversions_State &t_conversions) { if (!t_has_params || t_params.empty()) { return false; diff --git a/include/chaiscript/utility/json.hpp b/include/chaiscript/utility/json.hpp index 1d9aac2..bdcbb7c 100644 --- a/include/chaiscript/utility/json.hpp +++ b/include/chaiscript/utility/json.hpp @@ -212,16 +212,16 @@ class JSON } template - JSON( T b, typename enable_if::value>::type* = 0 ) : Internal( b ), Type( Class::Boolean ){} + JSON( T b, typename enable_if::value>::type* = nullptr ) : Internal( b ), Type( Class::Boolean ){} template - JSON( T i, typename enable_if::value && !is_same::value>::type* = 0 ) : Internal( long(i) ), Type( Class::Integral ){} + JSON( T i, typename enable_if::value && !is_same::value>::type* = nullptr ) : Internal( long(i) ), Type( Class::Integral ){} template - JSON( T f, typename enable_if::value>::type* = 0 ) : Internal( double(f) ), Type( Class::Floating ){} + JSON( T f, typename enable_if::value>::type* = nullptr ) : Internal( double(f) ), Type( Class::Floating ){} template - JSON( T s, typename enable_if::value>::type* = 0 ) : Internal( string( s ) ), Type( Class::String ){} + JSON( T s, typename enable_if::value>::type* = nullptr ) : Internal( string( s ) ), Type( Class::String ){} JSON( std::nullptr_t ) : Internal(), Type( Class::Null ){} diff --git a/unittests/compiled_tests.cpp b/unittests/compiled_tests.cpp index fcf96c8..551470e 100644 --- a/unittests/compiled_tests.cpp +++ b/unittests/compiled_tests.cpp @@ -1,12 +1,10 @@ // All of these are necessary because of catch.hpp. It's OK, they'll be // caught in other cpp files if chaiscript causes them -#include -#include -#ifdef CHAISCRIPT_MSVC +#ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable : 4190 4640 28251 4702 6330) +#pragma warning(disable : 4242 28251) #endif #ifdef __GNUC__ @@ -15,6 +13,13 @@ #endif +#include +#include +#include + + + + #define CATCH_CONFIG_MAIN #include @@ -929,7 +934,11 @@ TEST_CASE("Map conversions") TEST_CASE("Parse floats with non-posix locale") { - std::cout << "Current locale: " << std::setlocale(LC_ALL, "en_ZA.utf8") << '\n'; +#ifdef CHAISCRIPT_MSVC + std::setlocale(LC_ALL, "en-ZA"); +#else + std::setlocale(LC_ALL, "en_ZA.utf8"); +#endif chaiscript::ChaiScript chai; const double parsed = chai.eval("print(1.3); 1.3"); CHECK(parsed == Approx(1.3)); diff --git a/unittests/type_info_test.cpp b/unittests/type_info_test.cpp index 9b9fd92..15bd633 100644 --- a/unittests/type_info_test.cpp +++ b/unittests/type_info_test.cpp @@ -1,30 +1,21 @@ // Tests to make sure that the order in which function dispatches occur is correct +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4242 28251) +#endif + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wparentheses" +#endif + + #include #include #include #include -#ifdef CHAISCRIPT_MSVC -#pragma warning(push) -#pragma warning(disable : 4190 4640 28251 4702 6330) -#endif - -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wshadow" -#pragma GCC diagnostic ignored "-Wold-style-cast" -#endif - -#ifdef __llvm__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" -#pragma clang diagnostic ignored "-Wold-style-cast" -#pragma clang diagnostic ignored "-Wexit-time-destructors" -#pragma clang diagnostic ignored "-Wfloat-equal" -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif -