[Threads] Language extensions + MSVC (possible patch with new config)

Any opinions on this? It is a patch against 1.33.1. It is meant to be non-intrusive: nothing should change unless you want it to. The idea is that when building boost threads, you require language extensions via your silence on BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS but if you are not building boost threads, you don't need language extensions. The idea is that BOOST_DISABLE_WIN32 does not need to be defined if language extensions are not needed. I would appreciate any feedback towards a possible patch. I am currently running the boost thread tests and hoping that they don't fail ;) If all goes well, I will rebuild the rest of boost as well and run tests there. Index: boost/config/compiler/visualc.hpp =================================================================== --- boost/config/compiler/visualc.hpp (revision 322) +++ boost/config/compiler/visualc.hpp (working copy) @@ -99,7 +99,7 @@ // disable Win32 API's if compiler extentions are // turned off: // -#ifndef _MSC_EXTENSIONS +#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS) # define BOOST_DISABLE_WIN32 #endif Index: boost/thread/detail/config.hpp =================================================================== --- boost/thread/detail/config.hpp (revision 322) +++ boost/thread/detail/config.hpp (working copy) @@ -15,8 +15,20 @@ #include <boost/config.hpp> // insist on threading support being available: +// Don't need language extensions if we are not building boost +// threads +#if defined(BOOST_MSVC) && !defined(BOOST_BUILDING_THREADS) +# define BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS +# define DEFINED_BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS +#endif + #include <boost/config/requires_threads.hpp> +#if defined(DEFINED_BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS) +# undef BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS +# undef DEFINED_BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS +#endif + #if defined(BOOST_THREAD_BUILD_DLL) //Build dll #elif defined(BOOST_THREAD_BUILD_LIB) //Build lib #elif defined(BOOST_THREAD_USE_DLL) //Use dll Index: libs/thread/build/threads.jam =================================================================== --- libs/thread/build/threads.jam (revision 322) +++ libs/thread/build/threads.jam (working copy) @@ -63,6 +63,7 @@ : ## requirements ## <sysinclude>$(BOOST_ROOT) <threading>multi + <define>BOOST_BUILDING_THREADS=1 <borland><*><cxxflags>-w-8004 <borland><*><cxxflags>-w-8057 : ## default build ##

Sohail Somani wrote:
Any opinions on this? It is a patch against 1.33.1. It is meant to be non-intrusive: nothing should change unless you want it to. The idea is that when building boost threads, you require language extensions via your silence on BOOST_NO_REQUIRE_LANGUAGE_EXTENSIONS but if you are not building boost threads, you don't need language extensions. The idea is that BOOST_DISABLE_WIN32 does not need to be defined if language extensions are not needed.
I would appreciate any feedback towards a possible patch. I am currently running the boost thread tests and hoping that they don't fail ;) If all goes well, I will rebuild the rest of boost as well and run tests there.
Unfortunately that's going to break all kinds of things: Regex and Boost.Test almost for sure. I suggest you do a grep for BOOST_DISABLE_WIN32 and BOOST_HAS_THREADS: you will find their use ubiquitous throughout Boost. John.
participants (2)
-
John Maddock
-
Sohail Somani