From 2f2c97caa8322a65de146ce0a5939fb8890cb29e Mon Sep 17 00:00:00 2001 From: Steve Gates Date: Thu, 19 Jun 2014 20:30:41 -0700 Subject: [PATCH 1/5] Fixing break on cygwin because local_free_on_destruction.hpp is not included. Ticket #10137. --- include/boost/system/detail/error_code.ipp | 69 +++++++--------------- 1 file changed, 20 insertions(+), 49 deletions(-) diff --git a/include/boost/system/detail/error_code.ipp b/include/boost/system/detail/error_code.ipp index e5b13c2..71c60f6 100644 --- a/include/boost/system/detail/error_code.ipp +++ b/include/boost/system/detail/error_code.ipp @@ -22,7 +22,7 @@ # if defined( BOOST_WINDOWS_API ) # include -# if BOOST_PLAT_WINDOWS_DESKTOP +# if !BOOST_PLAT_WINDOWS_RUNTIME # include # endif # ifndef ERROR_INCORRECT_SIZE @@ -368,54 +368,7 @@ namespace std::string system_error_category::message( int ev ) const { -#if BOOST_PLAT_WINDOWS_DESKTOP - std::string str( 128, char() ); - for (;;) - { - DWORD retval = ::FormatMessageA( - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - ev, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - &str[0], - str.size(), - NULL - ); - - if ( retval > 0 ) - { - str.resize( retval ); - break; - } - else if ( ::GetLastError() != ERROR_INSUFFICIENT_BUFFER ) - { - return std::string("Unknown error"); - } - else - { - str.resize( str.size() + str.size()/2 ); - } - } -# elif !defined(BOOST_NO_ANSI_APIS) - LPVOID lpMsgBuf = 0; - DWORD retval = ::FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - ev, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPSTR) &lpMsgBuf, - 0, - NULL - ); - detail::local_free_on_destruction lfod(lpMsgBuf); - if (retval == 0) - return std::string("Unknown error"); - - std::string str( static_cast(lpMsgBuf) ); -# else // WinCE and Windows Runtime workaround +#if defined(UNDER_CE) || BOOST_PLAT_WINDOWS_RUNTIME || defined(BOOST_NO_ANSI_APIS) std::wstring buf(128, wchar_t()); for (;;) { @@ -453,6 +406,24 @@ namespace } std::string str( narrow_buffer ); +#else + LPVOID lpMsgBuf = 0; + DWORD retval = ::FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ev, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPSTR) &lpMsgBuf, + 0, + NULL + ); + detail::local_free_on_destruction lfod(lpMsgBuf); + if (retval == 0) + return std::string("Unknown error"); + + std::string str( static_cast(lpMsgBuf) ); # endif while ( str.size() && (str[str.size()-1] == '\n' || str[str.size()-1] == '\r') ) From 0d0e14b3c5b00d79d176064b7c8f2813fd89e0f8 Mon Sep 17 00:00:00 2001 From: Beman Date: Fri, 1 Aug 2014 07:19:58 -0400 Subject: [PATCH 2/5] Show more macros as defined or not defined to aid regression test interpretation. --- test/error_code_test.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/error_code_test.cpp b/test/error_code_test.cpp index 4065848..faf9e2d 100644 --- a/test/error_code_test.cpp +++ b/test/error_code_test.cpp @@ -59,6 +59,26 @@ 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 From 800fce3aafca1dc9fadede0afa028c69ea2b5fce Mon Sep 17 00:00:00 2001 From: Beman Date: Fri, 1 Aug 2014 10:49:40 -0400 Subject: [PATCH 3/5] 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 From 9379d94b2aa10bfbba36d0c571e4c09e56396d2b Mon Sep 17 00:00:00 2001 From: Beman Date: Sat, 2 Aug 2014 08:11:13 -0400 Subject: [PATCH 4/5] Show value of BOOST_PLAT_WINDOWS_DESKTOP --- test/config_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/config_test.cpp b/test/config_test.cpp index da637c3..eef8ab4 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -41,7 +41,8 @@ int main() 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; + std::cout << "BOOST_PLAT_WINDOWS_DESKTOP is defined as " + << BOOST_PLAT_WINDOWS_DESKTOP << std::endl; #else std::cout << "BOOST_PLAT_WINDOWS_DESKTOP is not defined" << std::endl; #endif From 43b08da03a3a147946cd224f90e874255d6c8fb2 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 18 Aug 2014 15:11:09 +0100 Subject: [PATCH 5/5] Add metadata file. --- meta/libraries.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 meta/libraries.json diff --git a/meta/libraries.json b/meta/libraries.json new file mode 100644 index 0000000..90d1218 --- /dev/null +++ b/meta/libraries.json @@ -0,0 +1,11 @@ +{ + "key": "system", + "name": "System", + "authors": [ + "Beman Dawes" + ], + "description": "Operating system support, including the diagnostics support that will be part of the C++0x standard library.", + "category": [ + "System" + ] +}