diff --git a/doc/html/boost_config/boost_macro_reference.html b/doc/html/boost_config/boost_macro_reference.html index b425d6eb..bc8efb2d 100644 --- a/doc/html/boost_config/boost_macro_reference.html +++ b/doc/html/boost_config/boost_macro_reference.html @@ -3969,7 +3969,7 @@ that is not otherwise described by one of the other Boost.Config macros. To use the macro you must first

-
#include <boost/detail/workaround.hpp>
+
#include <boost/config/workaround.hpp>
 

usage is then: @@ -4000,7 +4000,7 @@

Note: the ultimate source of documentation - for this macro is in boost/detail/workaround.hpp. + for this macro is in boost/config/workaround.hpp.

@@ -4196,7 +4196,16 @@

- BOOST_EXPLICIT_TEMPLATE_TYPE(t) BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t,v) BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t,v) + BOOST_EXPLICIT_TEMPLATE_TYPE(t) +

+

+ BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t,v) +

+

+ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) +

+

+ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t,v)

@@ -4465,6 +4474,8 @@

BOOST_LIKELY(X) +

+

BOOST_UNLIKELY(X)

@@ -4533,6 +4544,23 @@

+ + +

+ BOOST_PRAGMA_MESSAGE(M) +

+ + +

+ Defined in header <boost/config/pragma_message.hpp>, + this macro expands to the equivalent of #pragma + message(M). + M must be a string + literal. Example: BOOST_PRAGMA_MESSAGE("This header + is deprecated."). +

+ + diff --git a/doc/html/index.html b/doc/html/index.html index 397e2da3..185c0357 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -992,7 +992,7 @@ - +

Last revised: December 11, 2017 at 19:32:07 GMT

Last revised: December 12, 2017 at 18:14:39 GMT


diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 1f82b6fd..e89f6555 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -980,7 +980,7 @@ workarounds for compiler/standard library defects. This macro is used where a compiler specific workaround is required that is not otherwise described by one of the other Boost.Config macros. To use the macro you must first `` -#include +#include `` usage is then: `` @@ -1002,7 +1002,7 @@ For example of `__BORLANDC__` /unless/ the macro `BOOST_DETECT_OUTDATED_WORKAROUNDS` is defined, in which case evaluates to `(__BORLANDC__ <= 0x590)`. -[*Note]: the ultimate source of documentation for this macro is in [@../../../../boost/detail/workaround.hpp boost/detail/workaround.hpp]. +[*Note]: the ultimate source of documentation for this macro is in [@../../../../boost/config/workaround.hpp boost/config/workaround.hpp]. ]] [[`BOOST_PREVENT_MACRO_SUBSTITUTION`][ Sometimes you have a function name with the same name as a C macro, for example "min" and "max" @@ -1096,8 +1096,11 @@ In either case this macro has no effect on runtime behavior and performance of code. ]] [[`BOOST_EXPLICIT_TEMPLATE_TYPE(t)` + `BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t,v)` + `BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)` + `BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t,v)`][ Some compilers silently "fold" different function template instantiations if some of the template parameters don't appear in the function parameter list. @@ -1248,6 +1251,7 @@ If the compiler does not support this markup, `BOOST_NORETURN` is defined empty additional macro `BOOST_NO_NORETURN` is defined. ]] [[`BOOST_LIKELY(X)` + `BOOST_UNLIKELY(X)`][ These macros communicate to the compiler that the conditional expression `X` is likely or unlikely to yield a positive result. The expression should result in a boolean value. @@ -1276,6 +1280,9 @@ Usage example: typedef unsigned int BOOST_MAY_ALIAS aliasing_uint; `` ]] +[[`BOOST_PRAGMA_MESSAGE(M)`][Defined in header ``, +this macro expands to the equivalent of `#pragma message(M)`. `M` must be a string +literal. Example: `BOOST_PRAGMA_MESSAGE("This header is deprecated.")`.]] ] [endsect] diff --git a/include/boost/config/detail/suffix.hpp b/include/boost/config/detail/suffix.hpp index caa0b229..4aeac4c7 100644 --- a/include/boost/config/detail/suffix.hpp +++ b/include/boost/config/detail/suffix.hpp @@ -537,25 +537,10 @@ namespace std{ using ::type_info; } // ---------------------------------------------------------------------------// -// // Helper macro BOOST_STRINGIZE: -// Converts the parameter X to a string after macro replacement -// on X has been performed. -// -#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) -#define BOOST_DO_STRINGIZE(X) #X - -// // Helper macro BOOST_JOIN: -// The following piece of macro magic joins the two -// arguments together, even when one of the arguments is -// itself a macro (see 16.3.1 in C++ standard). The key -// is that macro expansion of macro arguments does not -// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. -// -#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) -#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) -#define BOOST_DO_JOIN2( X, Y ) X##Y + +#include // // Set some default values for compiler/library/platform names. diff --git a/include/boost/config/helper_macros.hpp b/include/boost/config/helper_macros.hpp new file mode 100644 index 00000000..3e79526d --- /dev/null +++ b/include/boost/config/helper_macros.hpp @@ -0,0 +1,37 @@ +#ifndef BOOST_CONFIG_HELPER_MACROS_HPP_INCLUDED +#define BOOST_CONFIG_HELPER_MACROS_HPP_INCLUDED + +// Copyright 2001 John Maddock. +// Copyright 2017 Peter Dimov. +// +// Distributed under 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 +// +// BOOST_STRINGIZE(X) +// BOOST_JOIN(X, Y) +// +// Note that this header is C compatible. + +// +// Helper macro BOOST_STRINGIZE: +// Converts the parameter X to a string after macro replacement +// on X has been performed. +// +#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) +#define BOOST_DO_STRINGIZE(X) #X + +// +// Helper macro BOOST_JOIN: +// The following piece of macro magic joins the two +// arguments together, even when one of the arguments is +// itself a macro (see 16.3.1 in C++ standard). The key +// is that macro expansion of macro arguments does not +// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. +// +#define BOOST_JOIN(X, Y) BOOST_DO_JOIN(X, Y) +#define BOOST_DO_JOIN(X, Y) BOOST_DO_JOIN2(X,Y) +#define BOOST_DO_JOIN2(X, Y) X##Y + +#endif // BOOST_CONFIG_HELPER_MACROS_HPP_INCLUDED diff --git a/include/boost/config/pragma_message.hpp b/include/boost/config/pragma_message.hpp new file mode 100644 index 00000000..d213f63c --- /dev/null +++ b/include/boost/config/pragma_message.hpp @@ -0,0 +1,29 @@ +#ifndef BOOST_CONFIG_PRAGMA_MESSAGE_HPP_INCLUDED +#define BOOST_CONFIG_PRAGMA_MESSAGE_HPP_INCLUDED + +// Copyright 2017 Peter Dimov. +// +// Distributed under 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 +// +// BOOST_PRAGMA_MESSAGE("message") +// +// Expands to the equivalent of #pragma message("message") +// +// Note that this header is C compatible. + +#include + +#if defined(BOOST_DISABLE_PRAGMA_MESSAGE) +# define BOOST_PRAGMA_MESSAGE(x) +#elif defined(__GNUC__) +# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x))) +#elif defined(_MSC_VER) +# define BOOST_PRAGMA_MESSAGE(x) __pragma(message(__FILE__ "(" BOOST_STRINGIZE(__LINE__) "): note: " x)) +#else +# define BOOST_PRAGMA_MESSAGE(x) +#endif + +#endif // BOOST_CONFIG_PRAGMA_MESSAGE_HPP_INCLUDED diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 09422bfc..9f1e4ea4 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -103,6 +103,8 @@ test-suite config [ run cstdint_test2.cpp : : : all gcc:"-Wno-long-long -Wextra" darwin:-Wno-long-long ] [ compile cstdint_include_test.cpp : all gcc:-Wextra ] [ run config_build_check.cpp : : : [ requires int128 cxx11_constexpr cxx11_user_defined_literals ] ] + [ run helper_macros_test.cpp ] + [ compile pragma_message_test.cpp ] ; obj has_clang_implicit_fallthrough : cmd_line_check.cpp : diff --git a/test/helper_macros_test.cpp b/test/helper_macros_test.cpp new file mode 100644 index 00000000..5bbea8dd --- /dev/null +++ b/test/helper_macros_test.cpp @@ -0,0 +1,30 @@ +// Copyright 2017 Peter Dimov. +// +// Distributed under 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 + +#include +#include + +int main() +{ +#define X pumpkin + + BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(X), "pumpkin" ); + BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(__LINE__), "16" ); + +#define Y 2 + + int BOOST_JOIN(X, Y) = 0; + (void)pumpkin2; + + int BOOST_JOIN(X, __LINE__) = 0; + (void)pumpkin23; + + BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(BOOST_JOIN(X, Y)), "pumpkin2" ); + BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(BOOST_JOIN(X, __LINE__)), "pumpkin27" ); + + return boost::report_errors(); +} diff --git a/test/pragma_message_test.cpp b/test/pragma_message_test.cpp new file mode 100644 index 00000000..9464897c --- /dev/null +++ b/test/pragma_message_test.cpp @@ -0,0 +1,18 @@ +// Copyright 2017 Peter Dimov. +// +// Distributed under 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 + +#include + +BOOST_PRAGMA_MESSAGE("first message") + +#define MSG2 "second message" +BOOST_PRAGMA_MESSAGE(MSG2) + +#include // BOOST_STRINGIZE + +#define MSG3 third message +BOOST_PRAGMA_MESSAGE(BOOST_STRINGIZE(MSG3))