mirror of
https://github.com/boostorg/config.git
synced 2025-07-30 04:17:16 +02:00
Merge branch 'feature/pragma-message' into develop
# Fixed Conflicts: # doc/html/index.html
This commit is contained in:
@ -3969,7 +3969,7 @@
|
||||
that is not otherwise described by one of the other Boost.Config
|
||||
macros. To use the macro you must first
|
||||
</p>
|
||||
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">workaround</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">config</span><span class="special">/</span><span class="identifier">workaround</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
usage is then:
|
||||
@ -4000,7 +4000,7 @@
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Note</strong></span>: the ultimate source of documentation
|
||||
for this macro is in <a href="../../../../../boost/detail/workaround.hpp" target="_top">boost/detail/workaround.hpp</a>.
|
||||
for this macro is in <a href="../../../../../boost/config/workaround.hpp" target="_top">boost/config/workaround.hpp</a>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -4196,7 +4196,16 @@
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_EXPLICIT_TEMPLATE_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> <code class="computeroutput"><span class="identifier">BOOST_EXPLICIT_TEMPLATE_NON_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span><span class="identifier">v</span><span class="special">)</span></code> <code class="computeroutput"><span class="identifier">BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> <code class="computeroutput"><span class="identifier">BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span><span class="identifier">v</span><span class="special">)</span></code>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_EXPLICIT_TEMPLATE_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code>
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_EXPLICIT_TEMPLATE_NON_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span><span class="identifier">v</span><span class="special">)</span></code>
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code>
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE</span><span class="special">(</span><span class="identifier">t</span><span class="special">,</span><span class="identifier">v</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
@ -4465,6 +4474,8 @@
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_LIKELY</span><span class="special">(</span><span class="identifier">X</span><span class="special">)</span></code>
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_UNLIKELY</span><span class="special">(</span><span class="identifier">X</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
@ -4533,6 +4544,23 @@
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">BOOST_PRAGMA_MESSAGE</span><span class="special">(</span><span class="identifier">M</span><span class="special">)</span></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Defined in header <code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">config</span><span class="special">/</span><span class="identifier">pragma_message</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>,
|
||||
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>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
|
@ -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 11, 2017 at 19:32:07 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: December 12, 2017 at 18:14:39 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -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 <boost/detail/workaround.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
``
|
||||
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 `<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.")`.]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@ -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 <boost/config/helper_macros.hpp>
|
||||
|
||||
//
|
||||
// Set some default values for compiler/library/platform names.
|
||||
|
37
include/boost/config/helper_macros.hpp
Normal file
37
include/boost/config/helper_macros.hpp
Normal file
@ -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
|
29
include/boost/config/pragma_message.hpp
Normal file
29
include/boost/config/pragma_message.hpp
Normal file
@ -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 <boost/config/helper_macros.hpp>
|
||||
|
||||
#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
|
@ -103,6 +103,8 @@ test-suite config
|
||||
[ run cstdint_test2.cpp : : : <warnings>all <toolset>gcc:<cxxflags>"-Wno-long-long -Wextra" <toolset>darwin:<cxxflags>-Wno-long-long ]
|
||||
[ compile cstdint_include_test.cpp : <warnings>all <toolset>gcc:<cxxflags>-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 :
|
||||
|
30
test/helper_macros_test.cpp
Normal file
30
test/helper_macros_test.cpp
Normal file
@ -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 <boost/config/helper_macros.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
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();
|
||||
}
|
18
test/pragma_message_test.cpp
Normal file
18
test/pragma_message_test.cpp
Normal 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/pragma_message.hpp>
|
||||
|
||||
BOOST_PRAGMA_MESSAGE("first message")
|
||||
|
||||
#define MSG2 "second message"
|
||||
BOOST_PRAGMA_MESSAGE(MSG2)
|
||||
|
||||
#include <boost/config.hpp> // BOOST_STRINGIZE
|
||||
|
||||
#define MSG3 third message
|
||||
BOOST_PRAGMA_MESSAGE(BOOST_STRINGIZE(MSG3))
|
Reference in New Issue
Block a user