From 800fce3aafca1dc9fadede0afa028c69ea2b5fce Mon Sep 17 00:00:00 2001 From: Beman Date: Fri, 1 Aug 2014 10:49:40 -0400 Subject: [PATCH] Neither MinGW or Cygwin versions of winerror.h work if used alone, so on either of these platforms include the full windows.h. Move reporting of configuration to a separate config_test.cpp program, and expand the coverage to report more macros. --- include/boost/system/windows_error.hpp | 8 ++ test/Jamfile.v2 | 3 + test/config_test.cpp | 64 +++++++++++++++ test/error_code_test.cpp | 31 -------- test/system/config_test/config_test.vcxproj | 88 +++++++++++++++++++++ test/system/system.sln | 8 ++ 6 files changed, 171 insertions(+), 31 deletions(-) create mode 100644 test/config_test.cpp create mode 100644 test/system/config_test/config_test.vcxproj diff --git a/include/boost/system/windows_error.hpp b/include/boost/system/windows_error.hpp index fff3a98..9d9d206 100644 --- a/include/boost/system/windows_error.hpp +++ b/include/boost/system/windows_error.hpp @@ -18,7 +18,15 @@ #ifdef BOOST_WINDOWS_API #include + +// Neither MinGW or Cygwin versions of winerror.h work if used alone, so on +// either of those platforms include the full windows.h + +#if defined(__MINGW32__) || defined(__CYGWIN__) +#include +#else #include +#endif namespace boost { diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4c5bd81..c6008fc 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -52,4 +52,7 @@ project [ run header_only_test.cpp : : : static ] + [ run config_test.cpp + : : : always_show_run_output + ] ; diff --git a/test/config_test.cpp b/test/config_test.cpp new file mode 100644 index 0000000..da637c3 --- /dev/null +++ b/test/config_test.cpp @@ -0,0 +1,64 @@ +// error_code_test.cpp ---------------------------------------------------------------// + +// Copyright Beman Dawes 2014 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// See library home page at http://www.boost.org/libs/system + +#include +#include + +using std::cout; +using std::endl; + +int main() +{ +#ifdef BOOST_WINDOWS_API + std::cout << "BOOST_WINDOWS_API is defined" << std::endl; +#else + std::cout << "BOOST_WINDOWS_API is not defined" << std::endl; +#endif +#ifdef _MSC_VER + std::cout << "_MSC_VER is defined as " << _MSC_VER << std::endl; +#else + std::cout << "_MSC_VER is not defined" << std::endl; +#endif +#ifdef __CYGWIN__ + std::cout << "__CYGWIN__ is defined" << std::endl; +#else + std::cout << "__CYGWIN__ is not defined" << std::endl; +#endif +#ifdef __MINGW32__ + std::cout << "__MINGW32__ is defined" << std::endl; +#else + std::cout << "__MINGW32__ is not defined" << std::endl; +#endif +#ifdef BOOST_POSIX_API + std::cout << "BOOST_POSIX_API is defined" << std::endl; +#else + std::cout << "BOOST_POSIX_API is not defined" << std::endl; +#endif +#ifdef BOOST_PLAT_WINDOWS_DESKTOP + std::cout << "BOOST_PLAT_WINDOWS_DESKTOP is defined" << std::endl; +#else + std::cout << "BOOST_PLAT_WINDOWS_DESKTOP is not defined" << std::endl; +#endif +#ifdef BOOST_NO_ANSI_APIS + std::cout << "BOOST_NO_ANSI_APIS is defined" << std::endl; +#else + std::cout << "BOOST_NO_ANSI_APIS is not defined" << std::endl; +#endif +#ifdef BOOST_NO_CXX11_NOEXCEPT + std::cout << "BOOST_NO_CXX11_NOEXCEPT is defined" << std::endl; +#else + std::cout << "BOOST_NO_CXX11_NOEXCEPT is not defined" << std::endl; +#endif +#ifdef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS + std::cout << "BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS is defined" << std::endl; +#else + std::cout << "BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS is not defined" << std::endl; +#endif + return 0; +} diff --git a/test/error_code_test.cpp b/test/error_code_test.cpp index faf9e2d..a9a928e 100644 --- a/test/error_code_test.cpp +++ b/test/error_code_test.cpp @@ -59,37 +59,6 @@ namespace int main( int, char ** ) { -#ifdef BOOST_WINDOWS_API - std::cout << "BOOST_WINDOWS_API is defined" << std::endl; -#else - std::cout << "BOOST_WINDOWS_API is not defined" << std::endl; -#endif -#ifdef BOOST_POSIX_API - std::cout << "BOOST_POSIX_API is defined" << std::endl; -#else - std::cout << "BOOST_POSIX_API is not defined" << std::endl; -#endif -#ifdef BOOST_PLAT_WINDOWS_DESKTOP - std::cout << "BOOST_PLAT_WINDOWS_DESKTOP is defined" << std::endl; -#else - std::cout << "BOOST_PLAT_WINDOWS_DESKTOP is not defined" << std::endl; -#endif -#ifdef BOOST_NO_ANSI_APIS - std::cout << "BOOST_NO_ANSI_APIS is defined" << std::endl; -#else - std::cout << "BOOST_NO_ANSI_APIS is not defined" << std::endl; -#endif -#ifdef BOOST_NO_CXX11_NOEXCEPT - std::cout << "BOOST_NO_CXX11_NOEXCEPT is defined" << std::endl; -#else - std::cout << "BOOST_NO_CXX11_NOEXCEPT is not defined" << std::endl; -#endif -#ifdef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS - std::cout << "BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS is defined" << std::endl; -#else - std::cout << "BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS is not defined" << std::endl; -#endif - std::cout << "Conversion use cases...\n"; error_condition x1( errc::file_exists ); //error_code x2( errc::file_exists ); // should fail to compile diff --git a/test/system/config_test/config_test.vcxproj b/test/system/config_test/config_test.vcxproj new file mode 100644 index 0000000..783e989 --- /dev/null +++ b/test/system/config_test/config_test.vcxproj @@ -0,0 +1,88 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {E18C2B56-DCEC-438F-9C38-3C8B08B65247} + Win32Proj + config_test + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/test/system/system.sln b/test/system/system.sln index 1a621b2..b544fb0 100644 --- a/test/system/system.sln +++ b/test/system/system.sln @@ -1,12 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.30626.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "system-dll", "system-dll\system-dll.vcxproj", "{419402D4-F990-4B05-A459-655E2DC33DC2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_code_test", "error_code_test\error_code_test.vcxproj", "{E50C14DC-547D-4C33-83EA-653C0D0D4E64}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "header_only_test", "header_only_test\header_only_test.vcxproj", "{3773451B-A618-4A26-A7F2-85554F4BD21B}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config_test", "config_test\config_test.vcxproj", "{E18C2B56-DCEC-438F-9C38-3C8B08B65247}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -25,6 +29,10 @@ Global {3773451B-A618-4A26-A7F2-85554F4BD21B}.Debug|Win32.Build.0 = Debug|Win32 {3773451B-A618-4A26-A7F2-85554F4BD21B}.Release|Win32.ActiveCfg = Release|Win32 {3773451B-A618-4A26-A7F2-85554F4BD21B}.Release|Win32.Build.0 = Release|Win32 + {E18C2B56-DCEC-438F-9C38-3C8B08B65247}.Debug|Win32.ActiveCfg = Debug|Win32 + {E18C2B56-DCEC-438F-9C38-3C8B08B65247}.Debug|Win32.Build.0 = Debug|Win32 + {E18C2B56-DCEC-438F-9C38-3C8B08B65247}.Release|Win32.ActiveCfg = Release|Win32 + {E18C2B56-DCEC-438F-9C38-3C8B08B65247}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE