1/*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
3 http://www.boost.org/
4
5 Copyright (c) 2022 Jeff Trull. Distributed under the Boost
6 Software License, Version 1.0. (See accompanying file
7 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9=============================================================================*/
10
11// Check generated line directives
12// This test covers issue #24
13
14// define one macro
15#define FOO
16
17// try a variation matrix:
18// 1. initial #if true vs. false
19// 2. with/without else clause
20// 3. additional text immediately after #endif vs. one line later
21
22#ifdef FOO
23struct Bar {};
24#endif
25struct Quux {};
26
27// initial #if false
28
29#ifndef FOO
30struct Bar {};
31#endif
32struct Quux {};
33
34// adding else clause
35
36#ifdef FOO
37struct Bar {};
38#else
39struct Baz {};
40#endif
41struct Quux {};
42
43#ifndef FOO
44struct Bar {};
45#else
46struct Baz {};
47#endif
48struct Quux {};
49
50// intermediate space before next line
51
52#ifdef FOO
53struct Bar {};
54#endif
55
56struct Quux {};
57
58#ifndef FOO
59struct Bar {};
60#endif
61
62struct Quux {};
63
64#ifdef FOO
65struct Bar {};
66#else
67struct Baz {};
68#endif
69
70struct Quux {};
71
72#ifndef FOO
73struct Bar {};
74#else
75struct Baz {};
76#endif
77
78struct Quux {};
79
80// varying the location of the "true" conditional block among 3
81
82#ifdef FOO
83// first block is present
84struct Bar {};
85#elif defined(BAR)
86struct Baz {};
87#else
88struct Boozle {};
89#endif
90
91struct Quux {};
92
93#ifndef FOO
94struct Bar {};
95#elif !defined(BAR)
96// second block is present
97struct Baz {};
98#else
99struct Boozle {};
100#endif
101
102struct Quux {};
103
104#ifndef FOO
105struct Bar {};
106#elif defined(BAR)
107struct Baz {};
108#else
109// third block is present
110struct Boozle {};
111#endif
112
113struct Quux {};
114
115// test two-part conditionals that have an elif instead of an else
116#ifdef FOO
117// first part true
118struct Bar {};
119#elif defined(BAR)
120struct Baz {};
121#endif
122struct Quux {};
123
124#ifndef FOO
125struct Bar {};
126#elif !defined(BAR)
127// second part true
128struct Baz {};
129#endif
130
131struct Quux {};
132
133// neither part true
134#ifndef FOO
135struct Bar {};
136#elif defined(BAR)
137struct Baz {};
138#endif
139struct Quux {};
140
141// one more test: extra empty line before else clause
142#ifndef FOO
143struct Bar {};
144#else
145
146struct Baz {};
147#endif
148struct Quux {};
149
150
151
152//R #line 23 "t_5_039.cpp"
153//R struct Bar {};
154//R
155//R struct Quux {};
156//R #line 32 "t_5_039.cpp"
157//R struct Quux {};
158//R #line 37 "t_5_039.cpp"
159//R struct Bar {};
160//R #line 41 "t_5_039.cpp"
161//R struct Quux {};
162//R #line 46 "t_5_039.cpp"
163//R struct Baz {};
164//R
165//R struct Quux {};
166//R #line 53 "t_5_039.cpp"
167//R struct Bar {};
168//R #line 56 "t_5_039.cpp"
169//R struct Quux {};
170//R #line 62 "t_5_039.cpp"
171//R struct Quux {};
172//R #line 65 "t_5_039.cpp"
173//R struct Bar {};
174//R #line 70 "t_5_039.cpp"
175//R struct Quux {};
176//R #line 75 "t_5_039.cpp"
177//R struct Baz {};
178//R #line 78 "t_5_039.cpp"
179//R struct Quux {};
180//R #line 84 "t_5_039.cpp"
181//R struct Bar {};
182//R #line 91 "t_5_039.cpp"
183//R struct Quux {};
184//R #line 97 "t_5_039.cpp"
185//R struct Baz {};
186//R #line 102 "t_5_039.cpp"
187//R struct Quux {};
188//R #line 110 "t_5_039.cpp"
189//R struct Boozle {};
190//R #line 113 "t_5_039.cpp"
191//R struct Quux {};
192//R #line 118 "t_5_039.cpp"
193//R struct Bar {};
194//R #line 122 "t_5_039.cpp"
195//R struct Quux {};
196//R #line 128 "t_5_039.cpp"
197//R struct Baz {};
198//R #line 131 "t_5_039.cpp"
199//R struct Quux {};
200//R #line 139 "t_5_039.cpp"
201//R struct Quux {};
202//R #line 146 "t_5_039.cpp"
203//R struct Baz {};
204//R
205//R struct Quux {};
206

source code of boost/libs/wave/test/testwave/testfiles/t_5_039.cpp