]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/wave/language_support.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / wave / language_support.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
3 Definition of the various language support constants
4
5 http://www.boost.org/
6
7 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
8 Software License, Version 1.0. (See accompanying file
9 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10=============================================================================*/
20effc67
TL
11#if !defined(BOOST_LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
12#define BOOST_LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED
7c673cae
FG
13
14#include <boost/wave/wave_config.hpp>
15
16// this must occur after all of the includes and before any code appears
17#ifdef BOOST_HAS_ABI_HEADERS
18#include BOOST_ABI_PREFIX
19#endif
20
21///////////////////////////////////////////////////////////////////////////////
22namespace boost {
23namespace wave {
24
25enum language_support {
20effc67 26 // support flags for C++98
7c673cae
FG
27 support_normal = 0x01,
28 support_cpp = support_normal,
29
30 support_option_long_long = 0x02,
31
32#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
20effc67 33 // support flags for C99
7c673cae
FG
34 support_option_variadics = 0x04,
35 support_c99 = support_option_variadics | support_option_long_long | 0x08,
36#endif
37#if BOOST_WAVE_SUPPORT_CPP0X != 0
20effc67 38 // support flags for C++11
b32b8144
FG
39 support_option_no_newline_at_end_of_file = 0x20,
40
41 support_cpp0x = support_option_variadics | support_option_long_long |
42 support_option_no_newline_at_end_of_file | 0x10,
7c673cae 43 support_cpp11 = support_cpp0x,
20effc67
TL
44#if BOOST_WAVE_SUPPORT_CPP1Z != 0
45 // support flags for C++17
46 support_option_has_include = 0x10000,
47
48 support_cpp1z = support_option_variadics | support_option_long_long |
49 support_option_no_newline_at_end_of_file | support_option_has_include |
50 0x20000,
51 support_cpp17 = support_cpp1z,
52#if BOOST_WAVE_SUPPORT_CPP2A != 0
53 // support flags for C++20
54 support_option_va_opt = 0x40000,
55
56 support_cpp2a = support_option_variadics | support_option_long_long |
57 support_option_no_newline_at_end_of_file | support_option_has_include |
58 support_option_va_opt | 0x80000,
59 support_cpp20 = support_cpp2a,
60#endif
61#endif
7c673cae
FG
62#endif
63
64 support_option_mask = 0xFFC0,
65 support_option_emit_contnewlines = 0x0040,
66 support_option_insert_whitespace = 0x0080,
67 support_option_preserve_comments = 0x0100,
68 support_option_no_character_validation = 0x0200,
69 support_option_convert_trigraphs = 0x0400,
70 support_option_single_line = 0x0800,
71 support_option_prefer_pp_numbers = 0x1000,
72 support_option_emit_line_directives = 0x2000,
73 support_option_include_guard_detection = 0x4000,
74 support_option_emit_pragma_directives = 0x8000
75};
76
77///////////////////////////////////////////////////////////////////////////////
78//
79// need_cpp
80//
81// Extract, if the language to support is C++98
82//
83///////////////////////////////////////////////////////////////////////////////
84inline bool
85need_cpp(language_support language)
86{
87 return (language & ~support_option_mask) == support_cpp;
88}
89
90///////////////////////////////////////////////////////////////////////////////
91//
92// need_cpp0x
93//
94// Extract, if the language to support is C++11
95//
96///////////////////////////////////////////////////////////////////////////////
97#if BOOST_WAVE_SUPPORT_CPP0X != 0
98
99inline bool
100need_cpp0x(language_support language)
101{
102 return (language & ~support_option_mask) == support_cpp0x;
103}
104
105#else
106
107inline bool
108need_cpp0x(language_support language)
109{
110 return false;
111}
112
113#endif
114
20effc67
TL
115///////////////////////////////////////////////////////////////////////////////
116//
117// need_cpp2a
118//
119// Extract if the language to support is C++20
120//
121///////////////////////////////////////////////////////////////////////////////
122#if BOOST_WAVE_SUPPORT_CPP2A != 0
123
124inline bool
125need_cpp2a(language_support language)
126{
127 return (language & ~support_option_mask) == support_cpp2a;
128}
129
130#else
131
132inline bool
133need_cpp2a(language_support language)
134{
135 return false;
136}
137
138#endif
139
7c673cae
FG
140#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
141///////////////////////////////////////////////////////////////////////////////
142//
143// need_c99
144//
145// Extract, if the language to support is C99
146//
147///////////////////////////////////////////////////////////////////////////////
148inline bool
149need_c99(language_support language)
150{
151 return (language & ~support_option_mask) == support_c99;
152}
153
154#else // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
155
156///////////////////////////////////////////////////////////////////////////////
157inline bool
158need_variadics(language_support language)
159{
160 return false;
161}
162
163///////////////////////////////////////////////////////////////////////////////
164inline language_support
165enable_variadics(language_support language, bool enable = true)
166{
167 return language;
168}
169
170//////////////////////////////////////////////////////////////////////////////
171inline bool
172need_c99(language_support language)
173{
174 return false;
175}
176
177#endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
178
179///////////////////////////////////////////////////////////////////////////////
180//
181// get_support_options
182//
183// Set preserve comments support in the language to support
184//
185///////////////////////////////////////////////////////////////////////////////
186inline language_support
187get_support_options(language_support language)
188{
189 return static_cast<language_support>(language & support_option_mask);
190}
191
192///////////////////////////////////////////////////////////////////////////////
193//
194// set_support_options
195//
196// Set language option (for fine tuning of lexer behavior)
197//
198///////////////////////////////////////////////////////////////////////////////
199inline language_support
200set_support_options(language_support language, language_support option)
201{
202 return static_cast<language_support>(
203 (language & ~support_option_mask) | (option & support_option_mask));
204}
205
206///////////////////////////////////////////////////////////////////////////////
207// Get and set different language options
208#define BOOST_WAVE_NEED_OPTION(option) \
209 inline bool need_ ## option(language_support language) \
210 { \
211 return (language & support_option_ ## option) ? true : false; \
212 } \
213 /**/
214
215#define BOOST_WAVE_ENABLE_OPTION(option) \
216 inline language_support \
217 enable_ ## option(language_support language, bool enable = true) \
218 { \
219 if (enable) \
220 return static_cast<language_support>(language | support_option_ ## option); \
221 return static_cast<language_support>(language & ~support_option_ ## option); \
222 } \
223 /**/
224
225#define BOOST_WAVE_OPTION(option) \
226 BOOST_WAVE_NEED_OPTION(option) \
227 BOOST_WAVE_ENABLE_OPTION(option) \
228 /**/
229
230///////////////////////////////////////////////////////////////////////////////
b32b8144
FG
231BOOST_WAVE_OPTION(long_long) // support_option_long_long
232BOOST_WAVE_OPTION(no_character_validation) // support_option_no_character_validation
233BOOST_WAVE_OPTION(preserve_comments) // support_option_preserve_comments
234BOOST_WAVE_OPTION(prefer_pp_numbers) // support_option_prefer_pp_numbers
235BOOST_WAVE_OPTION(emit_line_directives) // support_option_emit_line_directives
236BOOST_WAVE_OPTION(single_line) // support_option_single_line
237BOOST_WAVE_OPTION(convert_trigraphs) // support_option_convert_trigraphs
7c673cae 238#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
b32b8144 239BOOST_WAVE_OPTION(include_guard_detection) // support_option_include_guard_detection
7c673cae
FG
240#endif
241#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
b32b8144 242BOOST_WAVE_OPTION(variadics) // support_option_variadics
7c673cae 243#endif
20effc67
TL
244#if BOOST_WAVE_SUPPORT_VA_OPT != 0
245BOOST_WAVE_OPTION(va_opt) // support_option_va_opt
246#endif
7c673cae 247#if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0
b32b8144
FG
248BOOST_WAVE_OPTION(emit_pragma_directives) // support_option_emit_pragma_directives
249#endif
250BOOST_WAVE_OPTION(insert_whitespace) // support_option_insert_whitespace
251BOOST_WAVE_OPTION(emit_contnewlines) // support_option_emit_contnewlines
252#if BOOST_WAVE_SUPPORT_CPP0X != 0
253BOOST_WAVE_OPTION(no_newline_at_end_of_file) // support_no_newline_at_end_of_file
7c673cae 254#endif
20effc67
TL
255#if BOOST_WAVE_SUPPORT_HAS_INCLUDE != 0
256BOOST_WAVE_OPTION(has_include) // support_option_has_include
257#endif
7c673cae
FG
258
259#undef BOOST_WAVE_NEED_OPTION
260#undef BOOST_WAVE_ENABLE_OPTION
261#undef BOOST_WAVE_OPTION
262
263///////////////////////////////////////////////////////////////////////////////
264} // namespace wave
265} // namespace boost
266
267// the suffix header occurs after all of the code
268#ifdef BOOST_HAS_ABI_HEADERS
269#include BOOST_ABI_SUFFIX
270#endif
271
20effc67 272#endif // !defined(BOOST_LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)