diff --git a/classic/test/Jamfile b/classic/test/Jamfile index 5f54d1820..171fa466e 100644 --- a/classic/test/Jamfile +++ b/classic/test/Jamfile @@ -143,6 +143,7 @@ local multi-threading = /boost/thread//boost_thread test-suite "spirit.classic.utility.support" # This test doesn't actually use multiple threads : [ spirit-run scoped_lock_tests.cpp : : : $(multi-threading) ] + [ compile threads_disabled_compile.cpp ] ; test-suite "spirit.classic.iterator" diff --git a/classic/test/threads_disabled_compile.cpp b/classic/test/threads_disabled_compile.cpp new file mode 100644 index 000000000..208cd1125 --- /dev/null +++ b/classic/test/threads_disabled_compile.cpp @@ -0,0 +1,19 @@ +/*============================================================================= + Copyright (c) 2017 Nikita Kniazev + http://spirit.sourceforge.net/ + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Spirit should not include any Boost.Thread header until user explicitly +// requested threadsafe support with BOOST_SPIRIT_THREADSAFE defined. + +#undef BOOST_SPIRIT_THREADSAFE +#ifndef BOOST_DISABLE_THREADS +# define BOOST_DISABLE_THREADS +#endif +#include + +int main() { return 0; } diff --git a/include/boost/spirit/home/classic/utility.hpp b/include/boost/spirit/home/classic/utility.hpp index 8eec51a7f..d04c51dc6 100644 --- a/include/boost/spirit/home/classic/utility.hpp +++ b/include/boost/spirit/home/classic/utility.hpp @@ -34,7 +34,9 @@ // Utility.Support #include +#ifdef BOOST_SPIRIT_THREADSAFE #include +#endif #endif // !defined(BOOST_SPIRIT_UTILITY_MAIN_HPP)