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 bc8efb2d..caa4e5c9 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

-
+
-
+ - -
-
+
- +

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

Last revised: December 22, 2017 at 23:49:22 GMT


diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index e89f6555..9426531f 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -1282,7 +1282,21 @@ Usage example: ]] [[`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.")`.]] +literal. + +Example: `BOOST_PRAGMA_MESSAGE("This header is deprecated.")` + +The messages issued by `BOOST_PRAGMA_MESSAGE` can be suppressed by defining the macro +`BOOST_DISABLE_PRAGMA_MESSAGE`.]] + +[[`BOOST_HEADER_DEPRECATED(A)`][Defined in header ``, +this macro issues the message "This header is deprecated. Use `A` instead." via +`BOOST_PRAGMA_MESSAGE`. `A` must be a string literal. + +Example: `BOOST_HEADER_DEPRECATED("")` + +The messages issued by `BOOST_HEADER_DEPRECATED` can be suppressed by defining the macro +`BOOST_ALLOW_DEPRECATED_HEADERS`.]] ] [endsect] diff --git a/include/boost/config/header_deprecated.hpp b/include/boost/config/header_deprecated.hpp new file mode 100644 index 00000000..864554f2 --- /dev/null +++ b/include/boost/config/header_deprecated.hpp @@ -0,0 +1,26 @@ +#ifndef BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED +#define BOOST_CONFIG_HEADER_DEPRECATED_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_HEADER_DEPRECATED("") +// +// Expands to the equivalent of +// BOOST_PRAGMA_MESSAGE("This header is deprecated. Use instead.") +// +// Note that this header is C compatible. + +#include + +#if defined(BOOST_ALLOW_DEPRECATED_HEADERS) +# define BOOST_HEADER_DEPRECATED(a) +#else +# define BOOST_HEADER_DEPRECATED(a) BOOST_PRAGMA_MESSAGE("This header is deprecated. Use " a " instead.") +#endif + +#endif // BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9f1e4ea4..ee6ecadb 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -105,6 +105,7 @@ test-suite config [ run config_build_check.cpp : : : [ requires int128 cxx11_constexpr cxx11_user_defined_literals ] ] [ run helper_macros_test.cpp ] [ compile pragma_message_test.cpp ] + [ compile header_deprecated_test.cpp ] ; obj has_clang_implicit_fallthrough : cmd_line_check.cpp : diff --git a/test/header_deprecated_test.cpp b/test/header_deprecated_test.cpp new file mode 100644 index 00000000..6a99a97d --- /dev/null +++ b/test/header_deprecated_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_HEADER_DEPRECATED("") + +#define ALTERNATIVE "the suitable component header" +BOOST_HEADER_DEPRECATED(ALTERNATIVE) + +#include // BOOST_STRINGIZE + +#define HEADER +BOOST_HEADER_DEPRECATED(BOOST_STRINGIZE(HEADER))