]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/wave/include/boost/wave/language_support.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / wave / include / boost / wave / language_support.hpp
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 =============================================================================*/
11 #if !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
12 #define LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED
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 ///////////////////////////////////////////////////////////////////////////////
22 namespace boost {
23 namespace wave {
24
25 enum language_support {
26 // support flags for C++98
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
33 // support flags for C99
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
38 support_cpp0x = support_option_variadics | support_option_long_long | 0x10,
39 support_cpp11 = support_cpp0x,
40 #endif
41
42 support_option_mask = 0xFFC0,
43 support_option_emit_contnewlines = 0x0040,
44 support_option_insert_whitespace = 0x0080,
45 support_option_preserve_comments = 0x0100,
46 support_option_no_character_validation = 0x0200,
47 support_option_convert_trigraphs = 0x0400,
48 support_option_single_line = 0x0800,
49 support_option_prefer_pp_numbers = 0x1000,
50 support_option_emit_line_directives = 0x2000,
51 support_option_include_guard_detection = 0x4000,
52 support_option_emit_pragma_directives = 0x8000
53 };
54
55 ///////////////////////////////////////////////////////////////////////////////
56 //
57 // need_cpp
58 //
59 // Extract, if the language to support is C++98
60 //
61 ///////////////////////////////////////////////////////////////////////////////
62 inline bool
63 need_cpp(language_support language)
64 {
65 return (language & ~support_option_mask) == support_cpp;
66 }
67
68 ///////////////////////////////////////////////////////////////////////////////
69 //
70 // need_cpp0x
71 //
72 // Extract, if the language to support is C++11
73 //
74 ///////////////////////////////////////////////////////////////////////////////
75 #if BOOST_WAVE_SUPPORT_CPP0X != 0
76
77 inline bool
78 need_cpp0x(language_support language)
79 {
80 return (language & ~support_option_mask) == support_cpp0x;
81 }
82
83 #else
84
85 inline bool
86 need_cpp0x(language_support language)
87 {
88 return false;
89 }
90
91 #endif
92
93 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
94 ///////////////////////////////////////////////////////////////////////////////
95 //
96 // need_c99
97 //
98 // Extract, if the language to support is C99
99 //
100 ///////////////////////////////////////////////////////////////////////////////
101 inline bool
102 need_c99(language_support language)
103 {
104 return (language & ~support_option_mask) == support_c99;
105 }
106
107 #else // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
108
109 ///////////////////////////////////////////////////////////////////////////////
110 inline bool
111 need_variadics(language_support language)
112 {
113 return false;
114 }
115
116 ///////////////////////////////////////////////////////////////////////////////
117 inline language_support
118 enable_variadics(language_support language, bool enable = true)
119 {
120 return language;
121 }
122
123 //////////////////////////////////////////////////////////////////////////////
124 inline bool
125 need_c99(language_support language)
126 {
127 return false;
128 }
129
130 #endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
131
132 ///////////////////////////////////////////////////////////////////////////////
133 //
134 // get_support_options
135 //
136 // Set preserve comments support in the language to support
137 //
138 ///////////////////////////////////////////////////////////////////////////////
139 inline language_support
140 get_support_options(language_support language)
141 {
142 return static_cast<language_support>(language & support_option_mask);
143 }
144
145 ///////////////////////////////////////////////////////////////////////////////
146 //
147 // set_support_options
148 //
149 // Set language option (for fine tuning of lexer behavior)
150 //
151 ///////////////////////////////////////////////////////////////////////////////
152 inline language_support
153 set_support_options(language_support language, language_support option)
154 {
155 return static_cast<language_support>(
156 (language & ~support_option_mask) | (option & support_option_mask));
157 }
158
159 ///////////////////////////////////////////////////////////////////////////////
160 // Get and set different language options
161 #define BOOST_WAVE_NEED_OPTION(option) \
162 inline bool need_ ## option(language_support language) \
163 { \
164 return (language & support_option_ ## option) ? true : false; \
165 } \
166 /**/
167
168 #define BOOST_WAVE_ENABLE_OPTION(option) \
169 inline language_support \
170 enable_ ## option(language_support language, bool enable = true) \
171 { \
172 if (enable) \
173 return static_cast<language_support>(language | support_option_ ## option); \
174 return static_cast<language_support>(language & ~support_option_ ## option); \
175 } \
176 /**/
177
178 #define BOOST_WAVE_OPTION(option) \
179 BOOST_WAVE_NEED_OPTION(option) \
180 BOOST_WAVE_ENABLE_OPTION(option) \
181 /**/
182
183 ///////////////////////////////////////////////////////////////////////////////
184 BOOST_WAVE_OPTION(long_long) // support_option_long_long
185 BOOST_WAVE_OPTION(no_character_validation) // support_option_no_character_validation
186 BOOST_WAVE_OPTION(preserve_comments) // support_option_preserve_comments
187 BOOST_WAVE_OPTION(prefer_pp_numbers) // support_option_prefer_pp_numbers
188 BOOST_WAVE_OPTION(emit_line_directives) // support_option_emit_line_directives
189 BOOST_WAVE_OPTION(single_line) // support_option_single_line
190 BOOST_WAVE_OPTION(convert_trigraphs) // support_option_convert_trigraphs
191 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
192 BOOST_WAVE_OPTION(include_guard_detection) // support_option_include_guard_detection
193 #endif
194 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
195 BOOST_WAVE_OPTION(variadics) // support_option_variadics
196 #endif
197 #if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0
198 BOOST_WAVE_OPTION(emit_pragma_directives) // support_option_emit_pragma_directives
199 #endif
200 BOOST_WAVE_OPTION(insert_whitespace) // support_option_insert_whitespace
201 BOOST_WAVE_OPTION(emit_contnewlines) // support_option_emit_contnewlines
202
203 #undef BOOST_WAVE_NEED_OPTION
204 #undef BOOST_WAVE_ENABLE_OPTION
205 #undef BOOST_WAVE_OPTION
206
207 ///////////////////////////////////////////////////////////////////////////////
208 } // namespace wave
209 } // namespace boost
210
211 // the suffix header occurs after all of the code
212 #ifdef BOOST_HAS_ABI_HEADERS
213 #include BOOST_ABI_SUFFIX
214 #endif
215
216 #endif // !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)