Merge pull request #204 from boostorg/feature/header-deprecated

Add BOOST_HEADER_DEPRECATED
This commit is contained in:
jzmaddock
2018-01-21 10:18:58 +00:00
committed by GitHub
11 changed files with 109 additions and 19 deletions

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Acknowledgements</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Config">
<link rel="up" href="../index.html" title="Boost.Config">
<link rel="prev" href="rationale.html" title="Rationale">

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Boost Macro Reference</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Config">
<link rel="up" href="../index.html" title="Boost.Config">
<link rel="prev" href="../index.html" title="Boost.Config">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_config.boost_macro_reference"></a><a class="link" href="boost_macro_reference.html" title="Boost Macro Reference">Boost Macro Reference</a>
</h2></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects">Macros
that describe C++03 defects</a></span></dt>
<dt><span class="section"><a href="boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_optional_features">Macros
@ -4556,8 +4556,39 @@
this macro expands to the equivalent of <code class="computeroutput"><span class="preprocessor">#pragma</span>
<span class="identifier">message</span><span class="special">(</span><span class="identifier">M</span><span class="special">)</span></code>.
<code class="computeroutput"><span class="identifier">M</span></code> must be a string
literal. Example: <code class="computeroutput"><span class="identifier">BOOST_PRAGMA_MESSAGE</span><span class="special">(</span><span class="string">"This header
is deprecated."</span><span class="special">)</span></code>.
literal.
</p>
<p>
Example: <code class="computeroutput"><span class="identifier">BOOST_PRAGMA_MESSAGE</span><span class="special">(</span><span class="string">"This header
is deprecated."</span><span class="special">)</span></code>
</p>
<p>
The messages issued by <code class="computeroutput"><span class="identifier">BOOST_PRAGMA_MESSAGE</span></code>
can be suppressed by defining the macro <code class="computeroutput"><span class="identifier">BOOST_DISABLE_PRAGMA_MESSAGE</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="computeroutput"><span class="identifier">BOOST_HEADER_DEPRECATED</span><span class="special">(</span><span class="identifier">A</span><span class="special">)</span></code>
</p>
</td>
<td>
<p>
Defined in header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">config</span><span class="special">/</span><span class="identifier">header_deprecated</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>,
this macro issues the message "This header is deprecated.
Use <code class="computeroutput"><span class="identifier">A</span></code> instead."
via <code class="computeroutput"><span class="identifier">BOOST_PRAGMA_MESSAGE</span></code>.
<code class="computeroutput"><span class="identifier">A</span></code> must be a string
literal.
</p>
<p>
Example: <code class="computeroutput"><span class="identifier">BOOST_HEADER_DEPRECATED</span><span class="special">(</span><span class="string">"&lt;boost/config/workaround.hpp&gt;"</span><span class="special">)</span></code>
</p>
<p>
The messages issued by <code class="computeroutput"><span class="identifier">BOOST_HEADER_DEPRECATED</span></code>
can be suppressed by defining the macro <code class="computeroutput"><span class="identifier">BOOST_ALLOW_DEPRECATED_HEADERS</span></code>.
</p>
</td>
</tr>
@ -5925,7 +5956,7 @@
<a name="boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code"></a><a class="link" href="boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code" title="Macros for libraries with separate source code">Macros
for libraries with separate source code</a>
</h3></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code.macros_controlling_shared_library_symbol_visibility">Macros
controlling shared library symbol visibility</a></span></dt>
<dt><span class="section"><a href="boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code.abi_fixing">ABI

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Build Time Configuration</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Config">
<link rel="up" href="../index.html" title="Boost.Config">
<link rel="prev" href="boost_macro_reference.html" title="Boost Macro Reference">

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Standard Integer Types</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Config">
<link rel="up" href="../index.html" title="Boost.Config">
<link rel="prev" href="build_config.html" title="Build Time Configuration">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_config.cstdint"></a><a class="link" href="cstdint.html" title="Standard Integer Types">Standard Integer Types</a>
</h2></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="cstdint.html#boost_config.cstdint.overview">Overview</a></span></dt>
<dt><span class="section"><a href="cstdint.html#boost_config.cstdint.rationale">Rationale</a></span></dt>
<dt><span class="section"><a href="cstdint.html#boost_config.cstdint.ce"><span class="emphasis"><em>Caveat emptor</em></span></a></span></dt>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Guidelines for Boost Authors</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Config">
<link rel="up" href="../index.html" title="Boost.Config">
<link rel="prev" href="cstdint.html" title="Standard Integer Types">
@ -27,7 +27,7 @@
<a name="boost_config.guidelines_for_boost_authors"></a><a class="link" href="guidelines_for_boost_authors.html" title="Guidelines for Boost Authors">Guidelines for
Boost Authors</a>
</h2></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="guidelines_for_boost_authors.html#boost_config.guidelines_for_boost_authors.warnings">Disabling
Compiler Warnings</a></span></dt>
<dt><span class="section"><a href="guidelines_for_boost_authors.html#boost_config.guidelines_for_boost_authors.adding_new_defect_macros">Adding

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Rationale</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../index.html" title="Boost.Config">
<link rel="up" href="../index.html" title="Boost.Config">
<link rel="prev" href="guidelines_for_boost_authors.html" title="Guidelines for Boost Authors">
@ -26,7 +26,7 @@
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_config.rationale"></a><a class="link" href="rationale.html" title="Rationale">Rationale</a>
</h2></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="rationale.html#boost_config.rationale.the_problem">The problem</a></span></dt>
<dt><span class="section"><a href="rationale.html#boost_config.rationale.the_solution">The solution</a></span></dt>
</dl></div>

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Boost.Config</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Boost.Config">
<link rel="next" href="boost_config/boost_macro_reference.html" title="Boost Macro Reference">
</head>
@ -39,7 +39,7 @@
</div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dl class="toc">
<dt><span class="section"><a href="index.html#boost_config.configuring_boost_for_your_platform">Configuring
Boost for Your Platform</a></span></dt>
<dd><dl>
@ -127,7 +127,7 @@
<a name="boost_config.configuring_boost_for_your_platform"></a><a class="link" href="index.html#boost_config.configuring_boost_for_your_platform" title="Configuring Boost for Your Platform">Configuring
Boost for Your Platform</a>
</h2></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="index.html#boost_config.configuring_boost_for_your_platform.using_the_default_boost_configuration">Using
the default boost configuration</a></span></dt>
<dt><span class="section"><a href="index.html#boost_config.configuring_boost_for_your_platform.the__boost_config_hpp__header">The
@ -725,7 +725,7 @@
<a name="boost_config.configuring_boost_for_your_platform.advanced_configuration_usage"></a><a class="link" href="index.html#boost_config.configuring_boost_for_your_platform.advanced_configuration_usage" title="Advanced configuration usage">Advanced
configuration usage</a>
</h3></div></div></div>
<div class="toc"><dl>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="index.html#boost_config.configuring_boost_for_your_platform.advanced_configuration_usage.example_1__creating_our_own_frozen_configuration">Example
1: creating our own frozen configuration</a></span></dt>
<dt><span class="section"><a href="index.html#boost_config.configuring_boost_for_your_platform.advanced_configuration_usage.example_2__skipping_files_that_you_don_t_need">Example
@ -992,7 +992,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: December 12, 2017 at 18:14:39 GMT</small></p></td>
<td align="left"><p><small>Last revised: December 22, 2017 at 23:49:22 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@ -1282,7 +1282,21 @@ Usage example:
]]
[[`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.")`.]]
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 `<boost/config/header_deprecated.hpp>`,
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("<boost/config/workaround.hpp>")`
The messages issued by `BOOST_HEADER_DEPRECATED` can be suppressed by defining the macro
`BOOST_ALLOW_DEPRECATED_HEADERS`.]]
]
[endsect]

View File

@ -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("<alternative>")
//
// Expands to the equivalent of
// BOOST_PRAGMA_MESSAGE("This header is deprecated. Use <alternative> instead.")
//
// Note that this header is C compatible.
#include <boost/config/pragma_message.hpp>
#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

View File

@ -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 :

View File

@ -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/config/header_deprecated.hpp>
BOOST_HEADER_DEPRECATED("<boost/config/workaround.hpp>")
#define ALTERNATIVE "the suitable component header"
BOOST_HEADER_DEPRECATED(ALTERNATIVE)
#include <boost/config.hpp> // BOOST_STRINGIZE
#define HEADER <boost/config/workaround.hpp>
BOOST_HEADER_DEPRECATED(BOOST_STRINGIZE(HEADER))