diff --git a/include/boost/regex/config.hpp b/include/boost/regex/config.hpp index eb998110..1df0097d 100644 --- a/include/boost/regex/config.hpp +++ b/include/boost/regex/config.hpp @@ -201,7 +201,10 @@ # define BOOST_REGEX_HAS_OTHER_WCHAR_T # ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable : 4251 4231) +# pragma warning(disable : 4251) +#if BOOST_MSVC < 1700 +# pragma warning(disable : 4231) +#endif # if BOOST_MSVC < 1600 # pragma warning(disable : 4660) # endif diff --git a/include/boost/regex/v4/basic_regex.hpp b/include/boost/regex/v4/basic_regex.hpp index ac91af29..19623720 100644 --- a/include/boost/regex/v4/basic_regex.hpp +++ b/include/boost/regex/v4/basic_regex.hpp @@ -36,10 +36,16 @@ namespace boost{ #ifdef BOOST_MSVC #pragma warning(push) -#pragma warning(disable : 4251 4231 4800) +#pragma warning(disable : 4251) +#if BOOST_MSVC < 1700 +# pragma warning(disable : 4231) +#endif #if BOOST_MSVC < 1600 #pragma warning(disable : 4660) #endif +#if BOOST_MSVC < 1910 +#pragma warning(disable:4800) +#endif #endif namespace BOOST_REGEX_DETAIL_NS{ diff --git a/include/boost/regex/v4/basic_regex_creator.hpp b/include/boost/regex/v4/basic_regex_creator.hpp index 623e06f1..7c006527 100644 --- a/include/boost/regex/v4/basic_regex_creator.hpp +++ b/include/boost/regex/v4/basic_regex_creator.hpp @@ -33,7 +33,9 @@ #ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable: 4800) +#if BOOST_MSVC < 1910 +#pragma warning(disable:4800) +#endif #endif namespace boost{ diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index dc528a39..6c7065f0 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -35,7 +35,10 @@ namespace BOOST_REGEX_DETAIL_NS{ #ifdef BOOST_MSVC #pragma warning(push) -#pragma warning(disable:4244 4800) +#pragma warning(disable:4244) +#if BOOST_MSVC < 1910 +#pragma warning(disable:4800) +#endif #endif inline boost::intmax_t umax(mpl::false_ const&) diff --git a/include/boost/regex/v4/instances.hpp b/include/boost/regex/v4/instances.hpp index 05ac71a6..b70437e7 100644 --- a/include/boost/regex/v4/instances.hpp +++ b/include/boost/regex/v4/instances.hpp @@ -84,7 +84,10 @@ template class BOOST_REGEX_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher(ptr) - static_cast(data()); + return size_type(static_cast(ptr) - static_cast(data())); } void BOOST_REGEX_CALL clear() diff --git a/include/boost/regex/v4/regex_split.hpp b/include/boost/regex/v4/regex_split.hpp index 65b2c64a..afa56598 100644 --- a/include/boost/regex/v4/regex_split.hpp +++ b/include/boost/regex/v4/regex_split.hpp @@ -36,7 +36,9 @@ namespace boost{ #ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable: 4800) +#if BOOST_MSVC < 1910 +#pragma warning(disable:4800) +#endif #endif namespace BOOST_REGEX_DETAIL_NS{ diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp index 87030a83..e58d6bae 100644 --- a/include/boost/regex/v4/regex_traits_defaults.hpp +++ b/include/boost/regex/v4/regex_traits_defaults.hpp @@ -241,7 +241,7 @@ inline std::ptrdiff_t global_length(const char* p) template<> inline std::ptrdiff_t global_length(const wchar_t* p) { - return (std::wcslen)(p); + return (std::ptrdiff_t)(std::wcslen)(p); } #endif template diff --git a/include/boost/regex/v4/w32_regex_traits.hpp b/include/boost/regex/v4/w32_regex_traits.hpp index bf996d61..378ee856 100644 --- a/include/boost/regex/v4/w32_regex_traits.hpp +++ b/include/boost/regex/v4/w32_regex_traits.hpp @@ -51,8 +51,10 @@ #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4786) +#if BOOST_MSVC < 1910 #pragma warning(disable:4800) #endif +#endif namespace boost{ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f485058c..17f6b842 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -196,3 +196,8 @@ build-project ../example ; # `quick` target (for CI) run quick.cpp ../build//boost_regex ; + +compile test_warnings.cpp + : msvc:all msvc:on + gcc:all gcc:on + clang:all clang:on ; diff --git a/test/test_warnings.cpp b/test/test_warnings.cpp new file mode 100644 index 00000000..1c2a41d3 --- /dev/null +++ b/test/test_warnings.cpp @@ -0,0 +1,12 @@ +#ifdef _MSC_VER +#pragma warning(disable:4820 4668) +#endif + +#include + +void test_proc() +{ + std::string text, re; + boost::regex exp(re); + regex_match(text, exp); +} \ No newline at end of file