]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // (C) Copyright Edward Diener 2011-2015 | |
3 | // Use, modification and distribution are subject to the Boost Software License, | |
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt). | |
6 | ||
7 | #if !defined(BOOST_VMD_ASSERT_HPP) | |
8 | #define BOOST_VMD_ASSERT_HPP | |
9 | ||
10 | #include <boost/vmd/detail/setup.hpp> | |
11 | ||
12 | #if BOOST_PP_VARIADICS | |
13 | ||
14 | #include <boost/vmd/detail/assert.hpp> | |
15 | ||
16 | /* | |
17 | ||
18 | The succeeding comments in this file are in doxygen format. | |
19 | ||
20 | */ | |
21 | ||
22 | /** \file | |
23 | */ | |
24 | ||
25 | /** \def BOOST_VMD_ASSERT(...) | |
26 | ||
27 | \brief Conditionally causes an error to be generated. | |
f67539c2 | 28 | |
7c673cae FG |
29 | ... = variadic parameters, maximum of 2 will be considered. |
30 | Any variadic parameters beyond the maximum of 2 are just ignored. | |
f67539c2 | 31 | |
7c673cae FG |
32 | The first variadic parameter is: |
33 | ||
34 | cond = A condition that determines whether an assertion occurs. Valid values range from 0 to BOOST_PP_LIMIT_MAG. | |
35 | ||
f67539c2 TL |
36 | The second variadic parameter (optional) is: |
37 | ||
38 | errstr = An error string for generating a compiler error when using the VC++ compiler. | |
39 | The VC++ compiler is incapable of producing a preprocessor error so when the 'cond' | |
40 | is 0, a compiler error is generated by outputting C++ code in the form of: | |
41 | ||
42 | @code | |
43 | ||
44 | typedef char errstr[-1]; | |
45 | ||
46 | @endcode | |
47 | ||
48 | The errstr defaults to BOOST_VMD_ASSERT_ERROR if not supplied. | |
49 | It is only relevant for VC++. | |
7c673cae FG |
50 | |
51 | returns = If cond expands to 0, this macro causes an error. Otherwise, it expands to nothing. | |
52 | For all compilers other than Visual C++ the error is a preprocessing error. | |
53 | For Visual C++ the error is caused by output invalid C++: this error could be | |
54 | masked if the invalid output is ignored by a macro which invokes this macro. | |
55 | ||
56 | */ | |
57 | # define BOOST_VMD_ASSERT(...) \ | |
58 | BOOST_VMD_DETAIL_ASSERT(__VA_ARGS__) \ | |
59 | /**/ | |
60 | ||
61 | #endif /* BOOST_PP_VARIADICS */ | |
62 | #endif /* BOOST_VMD_ASSERT_HPP */ |