From 26fc812e21ed28c7b1707a49fa7ced25c116638e Mon Sep 17 00:00:00 2001 From: Edward Hennis Date: Thu, 3 Sep 2015 14:48:02 -0400 Subject: [PATCH] Changes to support VS2015 --- beast/cxx14/config.h | 12 +++++-- beast/module/core/core.unity.cpp | 4 +++ beast/module/core/native/BasicNativeHeaders.h | 3 ++ beast/utility/noexcept.h | 8 +++-- .../utility/tests/static_initializer.test.cpp | 2 +- site_scons/site_tools/VSProject.py | 36 +++++++++---------- 6 files changed, 40 insertions(+), 25 deletions(-) diff --git a/beast/cxx14/config.h b/beast/cxx14/config.h index 95ab10ea6..cb1f0a887 100644 --- a/beast/cxx14/config.h +++ b/beast/cxx14/config.h @@ -50,7 +50,9 @@ // Disables beast's std::equal safe iterator overloads #ifndef BEAST_NO_CXX14_EQUAL -# ifdef _MSC_VER +# if defined(_MSC_VER) && _MSC_VER >= 1900 +# define BEAST_NO_CXX14_EQUAL 1 +# elif defined(_MSC_VER) # define BEAST_NO_CXX14_EQUAL 0 # elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402 # define BEAST_NO_CXX14_EQUAL 1 @@ -61,7 +63,9 @@ // Disables beast's std::integer_sequence #ifndef BEAST_NO_CXX14_INTEGER_SEQUENCE -# ifdef _MSC_VER +# if defined(_MSC_VER) && _MSC_VER >= 1900 +# define BEAST_NO_CXX14_INTEGER_SEQUENCE 1 +# elif defined(_MSC_VER) # define BEAST_NO_CXX14_INTEGER_SEQUENCE 0 # elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402 # define BEAST_NO_CXX14_INTEGER_SEQUENCE 1 @@ -72,7 +76,9 @@ // Disables beast's std::make_reverse_iterator #ifndef BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR -# ifdef _MSC_VER +# if defined(_MSC_VER) && _MSC_VER >= 1900 +# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 1 +# elif defined(_MSC_VER) # define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 0 # elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402 # define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 1 diff --git a/beast/module/core/core.unity.cpp b/beast/module/core/core.unity.cpp index 6aabe3a89..3e4286a0e 100644 --- a/beast/module/core/core.unity.cpp +++ b/beast/module/core/core.unity.cpp @@ -26,6 +26,7 @@ #endif //============================================================================== + #include #include @@ -46,7 +47,10 @@ #include #if ! BEAST_MINGW + #pragma warning ( push ) + #pragma warning ( disable: 4091 ) #include + #pragma warning ( pop ) #if ! BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES #pragma comment (lib, "DbgHelp.lib") diff --git a/beast/module/core/native/BasicNativeHeaders.h b/beast/module/core/native/BasicNativeHeaders.h index 5dc0a9dbb..152fed561 100644 --- a/beast/module/core/native/BasicNativeHeaders.h +++ b/beast/module/core/native/BasicNativeHeaders.h @@ -106,7 +106,10 @@ #include #include #include + #pragma warning ( push ) + #pragma warning ( disable: 4091 ) #include + #pragma warning ( pop ) #include #include diff --git a/beast/utility/noexcept.h b/beast/utility/noexcept.h index 8a50d0903..03e177425 100644 --- a/beast/utility/noexcept.h +++ b/beast/utility/noexcept.h @@ -25,10 +25,12 @@ #define BEAST_UTILITY_NOEXCEPT_H_INCLUDED #ifdef _MSC_VER -# ifdef noexcept -# undef noexcept +# if _MSC_VER < 1900 +# ifdef noexcept +# undef noexcept +# endif +# define noexcept throw() # endif -# define noexcept throw() # if _MSC_VER > 1600 && ! _ALLOW_KEYWORD_MACROS # define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining) # endif diff --git a/beast/utility/tests/static_initializer.test.cpp b/beast/utility/tests/static_initializer.test.cpp index 3a00085c5..61159c343 100644 --- a/beast/utility/tests/static_initializer.test.cpp +++ b/beast/utility/tests/static_initializer.test.cpp @@ -158,7 +158,7 @@ static_initializer_test::test (cxx11_tag) t(counts); }); -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 // Visual Studio 2013 and earlier can exhibit both double // construction, and access before construction when function // local statics are initialized concurrently. diff --git a/site_scons/site_tools/VSProject.py b/site_scons/site_tools/VSProject.py index 998d69571..6a8ebe2e6 100644 --- a/site_scons/site_tools/VSProject.py +++ b/site_scons/site_tools/VSProject.py @@ -30,19 +30,19 @@ import SCons.Util UnicodeByteMarker = '\xEF\xBB\xBF' -V12DSPHeader = """\ +V14DSPHeader = """\ \r -\r +\r """ -V12DSPProjectConfiguration = """\ +V14DSPProjectConfiguration = """\ \r %(variant)s\r %(platform)s\r \r """ -V12DSPGlobals = """\ +V14DSPGlobals = """\ \r %(project_guid)s\r Win32Proj\r @@ -51,11 +51,11 @@ V12DSPGlobals = """\ \r """ -V12DSPPropertyGroup = """\ +V14DSPPropertyGroup = """\ \r MultiByte\r Application\r - v120\r + v140\r False\r %(use_debug_libs)s\r False\r @@ -65,17 +65,17 @@ V12DSPPropertyGroup = """\ \r """ -V12DSPImportGroup= """\ +V14DSPImportGroup= """\ \r \r \r """ -V12DSPItemDefinitionGroup= """\ +V14DSPItemDefinitionGroup= """\ \r """ -V12CustomBuildProtoc= """\ +V14CustomBuildProtoc= """\ Document\r protoc --cpp_out=%(cpp_out)s --proto_path=%%(RelativeDir) %%(Identity)\r %(base_out)s.pb.h;%(base_out)s.pb.cc\r @@ -83,7 +83,7 @@ V12CustomBuildProtoc= """\ false\r """ -V12DSPFiltersHeader = ( +V14DSPFiltersHeader = ( '''\r \r ''') @@ -663,13 +663,13 @@ class _ProjectGenerator(object): f = self.project_file f.write(UnicodeByteMarker) - f.write(V12DSPHeader % locals()) - f.write(V12DSPGlobals % locals()) + f.write(V14DSPHeader % locals()) + f.write(V14DSPGlobals % locals()) f.write(' \r\n') for config in self.configs: variant = config.variant platform = config.platform - f.write(V12DSPProjectConfiguration % locals()) + f.write(V14DSPProjectConfiguration % locals()) f.write(' \r\n') f.write(' \r\n') @@ -681,20 +681,20 @@ class _ProjectGenerator(object): config.target[0].get_abspath()), self.project_dir) out_dir = winpath(variant_dir) + ntpath.sep int_dir = winpath(ntpath.join(variant_dir, 'src')) + ntpath.sep - f.write(V12DSPPropertyGroup % locals()) + f.write(V14DSPPropertyGroup % locals()) f.write(' \r\n') f.write(' \r\n') for config in self.configs: variant = config.variant platform = config.platform - f.write(V12DSPImportGroup % locals()) + f.write(V14DSPImportGroup % locals()) f.write(' \r\n') for config in self.configs: variant = config.variant platform = config.platform - f.write(V12DSPItemDefinitionGroup % locals()) + f.write(V14DSPItemDefinitionGroup % locals()) # Cl options f.write(' \r\n') f.write( @@ -759,7 +759,7 @@ class _ProjectGenerator(object): out_parts = out_dir.split(os.sep) out_parts.append(os.path.splitext(os.path.basename(item.path()))[0]) base_out = ntpath.join(*out_parts) - props += V12CustomBuildProtoc % locals() + props += V14CustomBuildProtoc % locals() f.write(' <%(tag)s Include="%(path)s">\r\n' % locals()) f.write(props) @@ -783,7 +783,7 @@ class _ProjectGenerator(object): f = self.filters_file f.write(UnicodeByteMarker) - f.write(V12DSPFiltersHeader) + f.write(V14DSPFiltersHeader) f.write(' \r\n') groups = set()