From d1c3bf73de5e56d796ce5c7592bd9506f7751ded Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 9 May 2002 11:40:52 +0000 Subject: [PATCH] Added user-config macro BOOST_DISABLE_WIN32 (also set in the compiler 's strict mode). Modified Boost source not to use Win32 specific extentions in the presence of BOOST_DISABLE_WIN32. [SVN r13771] --- config.htm | 9 +++++++++ include/boost/config/compiler/borland.hpp | 10 ++++++++-- include/boost/config/compiler/comeau.hpp | 20 ++++++++++++++++++-- include/boost/config/compiler/intel.hpp | 10 ++++++---- include/boost/config/compiler/visualc.hpp | 13 ++++++++++--- include/boost/config/platform/win32.hpp | 3 +++ include/boost/config/suffix.hpp | 10 ++++++++++ include/boost/config/user.hpp | 4 ++++ test/config_info.cpp | 4 +++- 9 files changed, 71 insertions(+), 12 deletions(-) diff --git a/config.htm b/config.htm index 8df5e091..d2434148 100644 --- a/config.htm +++ b/config.htm @@ -270,6 +270,15 @@ they are listed in the following table: 

threading support, even if the compiler in its current translation mode supports multiple threads. + + BOOST_DISABLE_WIN32 + When defined, disables the use of Win32 specific + API's, even when these are available. Also has the effect + of setting BOOST_DISABLE_THREADS unless + BOOST_HAS_PTHREADS is set. This option may be set + automatically by the config system when it detects that + the compiler is in "strict mode". +

Advanced configuration usage

diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 17fd8108..1045e499 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -45,16 +45,22 @@ // std::DBL_MAX, as a fix we'll just include float.h and have done with: #include #endif - +// +// __int64: +// #if __BORLANDC__ >= 0x530 # define BOOST_HAS_MS_INT64 #endif - // // check for exception handling support: +// #ifndef _CPPUNWIND # define BOOST_NO_EXCEPTIONS #endif +// +// Disable Win32 support in ANSI mode: +// +#pragma defineonoption BOOST_DISABLE_WIN32 -A #define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__) diff --git a/include/boost/config/compiler/comeau.hpp b/include/boost/config/compiler/comeau.hpp index a902b22b..a0e8835a 100644 --- a/include/boost/config/compiler/comeau.hpp +++ b/include/boost/config/compiler/comeau.hpp @@ -12,8 +12,11 @@ #if (__COMO_VERSION__ <= 4245) || !defined(BOOST_STRICT_CONFIG) # if defined(_MSC_VER) && _MSC_VER <= 1300 # define BOOST_NO_STDC_NAMESPACE -# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP # define BOOST_NO_SWPRINTF +# if _MSC_VER > 100 + // only set this in non-strict mode: +# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# endif # endif // Void returns don't work when emulating VC 6 (Peter Dimov) @@ -22,11 +25,24 @@ # define BOOST_NO_VOID_RETURNS # endif + +#endif // version 4245 + +// +// enable __int64 support in VC emulation mode +// we should also set BOOST_HAS_LONG_LONG when that is +// supported, but there is no way we can detect it: +// # if defined(_MSC_VER) && (_MSC_VER >= 1200) # define BOOST_HAS_MS_INT64 # endif - +// +// disable win32 support unless we are in VC emulation mode, +// (what does this do to Como on top of Borland?): +// +#if defined(_WIN32) && (_MSC_VER+0 < 1000) +# define BOOST_DISABLE_WIN32 #endif #define BOOST_COMPILER "Comeau compiler version " BOOST_STRINGIZE(__COMO_VERSION__) diff --git a/include/boost/config/compiler/intel.hpp b/include/boost/config/compiler/intel.hpp index 4cd88f56..1bfb383d 100644 --- a/include/boost/config/compiler/intel.hpp +++ b/include/boost/config/compiler/intel.hpp @@ -48,7 +48,7 @@ #endif -#ifdef _MSC_VER +#if _MSC_VER+0 >= 1000 # ifndef _NATIVE_WCHAR_T_DEFINED # define BOOST_NO_INTRINSIC_WCHAR_T # endif @@ -56,6 +56,8 @@ # define BOOST_HAS_MS_INT64 # endif # define BOOST_NO_SWPRINTF +#elif defined(_WIN32) +# define BOOST_DISABLE_WIN32 #endif @@ -66,12 +68,12 @@ # error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 500: -#if (BOOST_INTEL_CXX_VERSION > 500) +// last known and checked version is 600: +#if (BOOST_INTEL_CXX_VERSION > 600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) -# warning "Unknown compiler version - please run the configure tests and report the results" +# pragma message("Unknown compiler version - please run the configure tests and report the results") # endif #endif diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index 3a8cebe8..f0088661 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -76,15 +76,22 @@ // // __int64 support: // -#if _MSC_VER >= 1200 +#if (_MSC_VER >= 1200) && defined(_MSC_EXTENSIONS) # define BOOST_HAS_MS_INT64 #endif // // long long support: // -#if _MSC_VER >= 1301 +#if (_MSC_VER >= 1301) && defined(_MSC_EXTENSIONS) # define BOOST_HAS_LONG_LONG #endif +// +// disable Win32 API's if compiler extentions are +// turned off: +// +#ifndef _MSC_EXTENSIONS +# define BOOST_DISABLE_WIN32 +#endif @@ -97,7 +104,7 @@ #error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 1300: +// last known and checked version is 1301: #if (_MSC_VER > 1301) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" diff --git a/include/boost/config/platform/win32.hpp b/include/boost/config/platform/win32.hpp index 1c7ac59e..491b8c3d 100644 --- a/include/boost/config/platform/win32.hpp +++ b/include/boost/config/platform/win32.hpp @@ -24,6 +24,7 @@ # define BOOST_NO_SWPRINTF #endif +#ifndef BOOST_DISABLE_WIN32 // // Win32 will normally be using native Win32 threads, // but there is a pthread library avaliable as an option: @@ -34,3 +35,5 @@ // WEK: Added #define BOOST_HAS_FTIME + +#endif diff --git a/include/boost/config/suffix.hpp b/include/boost/config/suffix.hpp index 3699c131..21350df7 100644 --- a/include/boost/config/suffix.hpp +++ b/include/boost/config/suffix.hpp @@ -133,6 +133,16 @@ # define BOOST_NO_SWPRINTF # endif +// +// If Win32 support is turned off, then we must turn off +// threading support also, unless there is some other +// thread API enabled: +// +#if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \ + && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS) +# define BOOST_DISABLE_THREADS +#endif + // // Turn on threading support if the compiler thinks that it's in // multithreaded mode. We put this here because there are only a diff --git a/include/boost/config/user.hpp b/include/boost/config/user.hpp index 01f31e67..98adbac9 100644 --- a/include/boost/config/user.hpp +++ b/include/boost/config/user.hpp @@ -61,4 +61,8 @@ // when available: // #define BOOST_DISABLE_THREADS +// define when you want to disable Win32 specific features +// even when available: +// #define BOOST_DISABLE_WIN32 + diff --git a/test/config_info.cpp b/test/config_info.cpp index 7e14ee6c..47c51720 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -822,6 +822,8 @@ void print_boost_macros() { std::cout << "Boost version " << BOOST_STRINGIZE(BOOST_VERSION) << std::endl; PRINT_MACRO(BOOST_DECL); + PRINT_MACRO(BOOST_DISABLE_THREADS); + PRINT_MACRO(BOOST_DISABLE_WIN32); PRINT_MACRO(BOOST_HAS_BETHREADS); PRINT_MACRO(BOOST_HAS_CLOCK_GETTIME); PRINT_MACRO(BOOST_HAS_FTIME); @@ -890,7 +892,6 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_SWPRINTF); PRINT_MACRO(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION); PRINT_MACRO(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS); - PRINT_MACRO(BOOST_DISABLE_THREADS); PRINT_MACRO(BOOST_NO_USING_TEMPLATE); PRINT_MACRO(BOOST_NO_VOID_RETURNS); PRINT_MACRO(BOOST_STD_EXTENSION_NAMESPACE); @@ -920,3 +921,4 @@ int main() +