diff --git a/doc/html/boost_config/acknowledgements.html b/doc/html/boost_config/acknowledgements.html index 8281d052..e3cd5555 100644 --- a/doc/html/boost_config/acknowledgements.html +++ b/doc/html/boost_config/acknowledgements.html @@ -3,7 +3,7 @@ Acknowledgements - + diff --git a/doc/html/boost_config/boost_macro_reference.html b/doc/html/boost_config/boost_macro_reference.html index 667484f9..b1266a09 100644 --- a/doc/html/boost_config/boost_macro_reference.html +++ b/doc/html/boost_config/boost_macro_reference.html @@ -3,7 +3,7 @@ Boost Macro Reference - + @@ -26,7 +26,7 @@

Boost Macro Reference

-
+
@@ -4183,7 +4195,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)

@@ -4452,6 +4473,8 @@

BOOST_LIKELY(X) +

+

BOOST_UNLIKELY(X)

@@ -4520,6 +4543,22 @@

+ + +

+ BOOST_PRAGMA_MESSAGE(M) +

+ + +

+ Expands to the equivalent of #pragma + message(M). + M must be a string + literal. Example: BOOST_PRAGMA_MESSAGE("This header + is deprecated."). +

+ + @@ -5884,7 +5923,7 @@
Macros for libraries with separate source code -
+ - -
-
+
- +

Last revised: July 21, 2017 at 18:08:20 GMT

Last revised: December 03, 2017 at 22:51:50 GMT


diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 94d0ca20..a3335447 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -1095,8 +1095,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. @@ -1247,6 +1250,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. @@ -1275,6 +1279,8 @@ Usage example: typedef unsigned int BOOST_MAY_ALIAS aliasing_uint; `` ]] +[[`BOOST_PRAGMA_MESSAGE(M)`][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/pragma_message.hpp b/include/boost/config/pragma_message.hpp new file mode 100644 index 00000000..a6292fd0 --- /dev/null +++ b/include/boost/config/pragma_message.hpp @@ -0,0 +1,24 @@ +#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") + +#if defined(__GNUC__) +#define BOOST_PRAGMA_MESSAGE_IMPL_1(x) _Pragma(#x) +#define BOOST_PRAGMA_MESSAGE(x) BOOST_PRAGMA_MESSAGE_IMPL_1(message(x)) +#elif defined(_MSC_VER) +#define BOOST_PRAGMA_MESSAGE_IMPL_2(x, f, ln) __pragma(message(f "(" #ln "): note: " x)) +#define BOOST_PRAGMA_MESSAGE_IMPL_1(x, f, ln) BOOST_PRAGMA_MESSAGE_IMPL_2(x, f, ln) +#define BOOST_PRAGMA_MESSAGE(x) BOOST_PRAGMA_MESSAGE_IMPL_1(x, __FILE__, __LINE__) +#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..16147352 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -103,6 +103,7 @@ 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 ] ] + [ compile pragma_message_test.cpp ] ; obj has_clang_implicit_fallthrough : cmd_line_check.cpp : 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))