]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / whatis.cc
1 // { dg-do run }
2 // { dg-options "-g -O0 -std=gnu++11" }
3
4 // Copyright (C) 2011-2014 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21 #include <string>
22 #include <iostream>
23 #include <regex>
24
25 template<class T>
26 void
27 placeholder(const T *s)
28 {
29 std::cout << (void *) s;
30 }
31
32 template<class T>
33 struct holder
34 {
35 T *f;
36 };
37
38 typedef std::basic_string<unsigned char> ustring;
39
40 // This test is written in a somewhat funny way.
41 // Each type under test is used twice: first, to form a pointer type,
42 // and second, as a template parameter. This is done to work around
43 // apparent GCC oddities. The pointer type is needed to ensure that
44 // the typedef in question ends up in the debuginfo; while the
45 // template type is used to ensure that a typedef-less variant is
46 // presented to gdb.
47
48 std::string *string_ptr;
49 holder<std::string> string_holder;
50 // { dg-final { whatis-test string_holder "holder<std::string>" } }
51 std::ios *ios_ptr;
52 holder<std::ios> ios_holder;
53 // { dg-final { whatis-test ios_holder "holder<std::ios>" } }
54 std::streambuf *streambuf_ptr;
55 holder<std::streambuf> streambuf_holder;
56 // { dg-final { whatis-test streambuf_holder "holder<std::streambuf>" } }
57 std::istream *istream_ptr;
58 holder<std::istream> istream_holder;
59 // { dg-final { whatis-test istream_holder "holder<std::istream>" } }
60 std::ostream *ostream_ptr;
61 holder<std::ostream> ostream_holder;
62 // { dg-final { whatis-test ostream_holder "holder<std::ostream>" } }
63 std::iostream *iostream_ptr;
64 holder<std::iostream> iostream_holder;
65 // { dg-final { whatis-test iostream_holder "holder<std::iostream>" } }
66 std::stringbuf *stringbuf_ptr;
67 holder<std::stringbuf> stringbuf_holder;
68 // { dg-final { whatis-test stringbuf_holder "holder<std::stringbuf>" } }
69 std::istringstream *istringstream_ptr;
70 holder<std::istringstream> istringstream_holder;
71 // { dg-final { whatis-test istringstream_holder "holder<std::istringstream>" } }
72 std::ostringstream *ostringstream_ptr;
73 holder<std::ostringstream> ostringstream_holder;
74 // { dg-final { whatis-test ostringstream_holder "holder<std::ostringstream>" } }
75 std::stringstream *stringstream_ptr;
76 holder<std::stringstream> stringstream_holder;
77 // { dg-final { whatis-test stringstream_holder "holder<std::stringstream>" } }
78 std::filebuf *filebuf_ptr;
79 holder<std::filebuf> filebuf_holder;
80 // { dg-final { whatis-test filebuf_holder "holder<std::filebuf>" } }
81 std::ifstream *ifstream_ptr;
82 holder<std::ifstream> ifstream_holder;
83 // { dg-final { whatis-test ifstream_holder "holder<std::ifstream>" } }
84 std::ofstream *ofstream_ptr;
85 holder<std::ofstream> ofstream_holder;
86 // { dg-final { whatis-test ofstream_holder "holder<std::ofstream>" } }
87 std::fstream *fstream_ptr;
88 holder<std::fstream> fstream_holder;
89 // { dg-final { whatis-test fstream_holder "holder<std::fstream>" } }
90 std::streampos *streampos_ptr;
91 holder<std::streampos> streampos_holder;
92 // { dg-final { whatis-test streampos_holder "holder<std::streampos>" } }
93 std::regex *regex_ptr;
94 holder<std::regex> regex_holder;
95 // { dg-final { whatis-test regex_holder "holder<std::regex>" } }
96 std::csub_match *csub_match_ptr;
97 holder<std::csub_match> csub_match_holder;
98 // { dg-final { whatis-test csub_match_holder "holder<std::csub_match>" } }
99 std::ssub_match *ssub_match_ptr;
100 holder<std::ssub_match> ssub_match_holder;
101 // { dg-final { whatis-test ssub_match_holder "holder<std::ssub_match>" } }
102 std::cmatch *cmatch_ptr;
103 holder<std::cmatch> cmatch_holder;
104 // { dg-final { whatis-test cmatch_holder "holder<std::cmatch>" } }
105 std::smatch *smatch_ptr;
106 holder<std::smatch> smatch_holder;
107 // { dg-final { whatis-test smatch_holder "holder<std::smatch>" } }
108 std::cregex_iterator *cregex_iterator_ptr;
109 holder<std::cregex_iterator> cregex_iterator_holder;
110 // { dg-final { whatis-test cregex_iterator_holder "holder<std::cregex_iterator>" } }
111 std::sregex_iterator *sregex_iterator_ptr;
112 holder<std::sregex_iterator> sregex_iterator_holder;
113 // { dg-final { whatis-test sregex_iterator_holder "holder<std::sregex_iterator>" } }
114 std::cregex_token_iterator *cregex_token_iterator_ptr;
115 holder<std::cregex_token_iterator> cregex_token_iterator_holder;
116 // { dg-final { whatis-test cregex_token_iterator_holder "holder<std::cregex_token_iterator>" } }
117 std::sregex_token_iterator *sregex_token_iterator_ptr;
118 holder<std::sregex_token_iterator> sregex_token_iterator_holder;
119 // { dg-final { whatis-test sregex_token_iterator_holder "holder<std::sregex_token_iterator>" } }
120 std::u16string *u16string_ptr;
121 holder<std::u16string> u16string_holder;
122 // { dg-final { whatis-test u16string_holder "holder<std::u16string>" } }
123 std::u32string *u32string_ptr;
124 holder<std::u32string> u32string_holder;
125 // { dg-final { whatis-test u32string_holder "holder<std::u32string>" } }
126 std::minstd_rand0 *minstd_rand0_ptr;
127 holder<std::minstd_rand0> minstd_rand0_holder;
128 // { dg-final { whatis-test minstd_rand0_holder "holder<std::minstd_rand0>" } }
129 std::minstd_rand *minstd_rand_ptr;
130 holder<std::minstd_rand> minstd_rand_holder;
131 // { dg-final { whatis-test minstd_rand_holder "holder<std::minstd_rand>" } }
132 std::mt19937 *mt19937_ptr;
133 holder<std::mt19937> mt19937_holder;
134 // { dg-final { whatis-test mt19937_holder "holder<std::mt19937>" } }
135 std::mt19937_64 *mt19937_64_ptr;
136 holder<std::mt19937_64> mt19937_64_holder;
137 // { dg-final { whatis-test mt19937_64_holder "holder<std::mt19937_64>" } }
138 std::ranlux24_base *ranlux24_base_ptr;
139 holder<std::ranlux24_base> ranlux24_base_holder;
140 // { dg-final { whatis-test ranlux24_base_holder "holder<std::ranlux24_base>" } }
141 std::ranlux48_base *ranlux48_base_ptr;
142 holder<std::ranlux48_base> ranlux48_base_holder;
143 // { dg-final { whatis-test ranlux48_base_holder "holder<std::ranlux48_base>" } }
144 std::ranlux24 *ranlux24_ptr;
145 holder<std::ranlux24> ranlux24_holder;
146 // { dg-final { whatis-test ranlux24_holder "holder<std::ranlux24>" } }
147 std::ranlux48 *ranlux48_ptr;
148 holder<std::ranlux48> ranlux48_holder;
149 // { dg-final { whatis-test ranlux48_holder "holder<std::ranlux48>" } }
150 std::knuth_b *knuth_b_ptr;
151 holder<std::knuth_b> knuth_b_holder;
152 // { dg-final { whatis-test knuth_b_holder "holder<std::knuth_b>" } }
153
154 ustring *ustring_ptr;
155 holder<ustring> ustring_holder;
156 // { dg-final { whatis-test ustring_holder "holder<std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> > >" } }
157
158 std::basic_string<signed char> *sstring_ptr;
159 holder< std::basic_string<signed char> > sstring_holder;
160 // { dg-final { whatis-test sstring_holder "holder<std::basic_string<signed char, std::char_traits<signed char>, std::allocator<signed char> > >" } }
161
162 int
163 main()
164 {
165 placeholder(&ios_ptr); // Mark SPOT
166 placeholder(&ios_holder);
167 placeholder(&string_ptr);
168 placeholder(&string_holder);
169 placeholder(&streambuf_ptr);
170 placeholder(&streambuf_holder);
171 placeholder(&istream_ptr);
172 placeholder(&istream_holder);
173 placeholder(&ostream_ptr);
174 placeholder(&ostream_holder);
175 placeholder(&iostream_ptr);
176 placeholder(&iostream_holder);
177 placeholder(&stringbuf_ptr);
178 placeholder(&stringbuf_holder);
179 placeholder(&istringstream_ptr);
180 placeholder(&istringstream_holder);
181 placeholder(&ostringstream_ptr);
182 placeholder(&ostringstream_holder);
183 placeholder(&stringstream_ptr);
184 placeholder(&stringstream_holder);
185 placeholder(&filebuf_ptr);
186 placeholder(&filebuf_holder);
187 placeholder(&ifstream_ptr);
188 placeholder(&ifstream_holder);
189 placeholder(&ofstream_ptr);
190 placeholder(&ofstream_holder);
191 placeholder(&fstream_ptr);
192 placeholder(&fstream_holder);
193 placeholder(&streampos_ptr);
194 placeholder(&streampos_holder);
195 placeholder(&regex_ptr);
196 placeholder(&regex_holder);
197 placeholder(&csub_match_ptr);
198 placeholder(&csub_match_holder);
199 placeholder(&ssub_match_ptr);
200 placeholder(&ssub_match_holder);
201 placeholder(&cmatch_ptr);
202 placeholder(&cmatch_holder);
203 placeholder(&smatch_ptr);
204 placeholder(&smatch_holder);
205 placeholder(&cregex_iterator_ptr);
206 placeholder(&cregex_iterator_holder);
207 placeholder(&sregex_iterator_ptr);
208 placeholder(&sregex_iterator_holder);
209 placeholder(&cregex_token_iterator_ptr);
210 placeholder(&cregex_token_iterator_holder);
211 placeholder(&sregex_token_iterator_ptr);
212 placeholder(&sregex_token_iterator_holder);
213 placeholder(&u16string_ptr);
214 placeholder(&u16string_holder);
215 placeholder(&u32string_ptr);
216 placeholder(&u32string_holder);
217 placeholder(&minstd_rand0_ptr);
218 placeholder(&minstd_rand0_holder);
219 placeholder(&minstd_rand_ptr);
220 placeholder(&minstd_rand_holder);
221 placeholder(&mt19937_ptr);
222 placeholder(&mt19937_holder);
223 placeholder(&mt19937_64_ptr);
224 placeholder(&mt19937_64_holder);
225 placeholder(&ranlux24_base_ptr);
226 placeholder(&ranlux24_base_holder);
227 placeholder(&ranlux48_base_ptr);
228 placeholder(&ranlux48_base_holder);
229 placeholder(&ranlux24_ptr);
230 placeholder(&ranlux24_holder);
231 placeholder(&ranlux48_ptr);
232 placeholder(&ranlux48_holder);
233 placeholder(&knuth_b_ptr);
234 placeholder(&knuth_b_holder);
235 placeholder(&ustring_ptr);
236 placeholder(&ustring_holder);
237 placeholder(&sstring_ptr);
238 placeholder(&sstring_holder);
239
240 return 0;
241 }
242
243 // { dg-final { gdb-test SPOT } }