1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // Test that we can include each header in two TU's and link them together. 10 11 // RUN: %{cxx} -c %s -o %t.first.o %{flags} %{compile_flags} 12 // RUN: %{cxx} -c %s -o %t.second.o -DWITH_MAIN %{flags} %{compile_flags} 13 // RUN: %{cxx} -o %t.exe %t.first.o %t.second.o %{flags} %{link_flags} 14 // RUN: %{run} 15 16 // The system-provided <uchar.h> seems to be broken on AIX 17 // XFAIL: LIBCXX-AIX-FIXME 18 19 // Prevent <ext/hash_map> from generating deprecated warnings for this test. 20 #if defined(__DEPRECATED) 21 # undef __DEPRECATED 22 #endif 23 24 /* 25 BEGIN-SCRIPT 26 27 for header in public_headers: 28 print("{}#{}include <{}>{}".format( 29 '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', 30 3 * ' ' if header in header_restrictions else '', 31 header, 32 '\n#endif' if header in header_restrictions else '' 33 )) 34 35 END-SCRIPT 36 */ 37 38 // DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW 39 // GENERATED-MARKER 40 #include <algorithm> 41 #include <any> 42 #include <array> 43 #include <atomic> 44 #if !defined(_LIBCPP_HAS_NO_THREADS) 45 # include <barrier> 46 #endif 47 #include <bit> 48 #include <bitset> 49 #include <cassert> 50 #include <ccomplex> 51 #include <cctype> 52 #include <cerrno> 53 #include <cfenv> 54 #include <cfloat> 55 #include <charconv> 56 #include <chrono> 57 #include <cinttypes> 58 #include <ciso646> 59 #include <climits> 60 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 61 # include <clocale> 62 #endif 63 #include <cmath> 64 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 65 # include <codecvt> 66 #endif 67 #include <compare> 68 #include <complex> 69 #include <complex.h> 70 #include <concepts> 71 #include <condition_variable> 72 #include <coroutine> 73 #include <csetjmp> 74 #include <csignal> 75 #include <cstdarg> 76 #include <cstdbool> 77 #include <cstddef> 78 #include <cstdint> 79 #include <cstdio> 80 #include <cstdlib> 81 #include <cstring> 82 #include <ctgmath> 83 #include <ctime> 84 #include <ctype.h> 85 #include <cuchar> 86 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 87 # include <cwchar> 88 #endif 89 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 90 # include <cwctype> 91 #endif 92 #include <deque> 93 #include <errno.h> 94 #include <exception> 95 #include <execution> 96 #include <fenv.h> 97 #if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) 98 # include <filesystem> 99 #endif 100 #include <float.h> 101 #include <format> 102 #include <forward_list> 103 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 104 # include <fstream> 105 #endif 106 #include <functional> 107 #if !defined(_LIBCPP_HAS_NO_THREADS) 108 # include <future> 109 #endif 110 #include <initializer_list> 111 #include <inttypes.h> 112 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 113 # include <iomanip> 114 #endif 115 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 116 # include <ios> 117 #endif 118 #include <iosfwd> 119 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 120 # include <iostream> 121 #endif 122 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 123 # include <istream> 124 #endif 125 #include <iterator> 126 #if !defined(_LIBCPP_HAS_NO_THREADS) 127 # include <latch> 128 #endif 129 #include <limits> 130 #include <limits.h> 131 #include <list> 132 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 133 # include <locale> 134 #endif 135 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 136 # include <locale.h> 137 #endif 138 #include <map> 139 #include <math.h> 140 #include <memory> 141 #if !defined(_LIBCPP_HAS_NO_THREADS) 142 # include <mutex> 143 #endif 144 #include <new> 145 #include <numbers> 146 #include <numeric> 147 #include <optional> 148 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 149 # include <ostream> 150 #endif 151 #include <queue> 152 #include <random> 153 #include <ranges> 154 #include <ratio> 155 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 156 # include <regex> 157 #endif 158 #include <scoped_allocator> 159 #if !defined(_LIBCPP_HAS_NO_THREADS) 160 # include <semaphore> 161 #endif 162 #include <set> 163 #include <setjmp.h> 164 #if !defined(_LIBCPP_HAS_NO_THREADS) 165 # include <shared_mutex> 166 #endif 167 #include <span> 168 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 169 # include <sstream> 170 #endif 171 #include <stack> 172 #if __cplusplus > 202002L && !defined(_LIBCPP_HAS_NO_THREADS) 173 # include <stdatomic.h> 174 #endif 175 #include <stdbool.h> 176 #include <stddef.h> 177 #include <stdexcept> 178 #include <stdint.h> 179 #include <stdio.h> 180 #include <stdlib.h> 181 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 182 # include <streambuf> 183 #endif 184 #include <string> 185 #include <string.h> 186 #include <string_view> 187 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 188 # include <strstream> 189 #endif 190 #include <system_error> 191 #include <tgmath.h> 192 #if !defined(_LIBCPP_HAS_NO_THREADS) 193 # include <thread> 194 #endif 195 #include <tuple> 196 #include <type_traits> 197 #include <typeindex> 198 #include <typeinfo> 199 #include <uchar.h> 200 #include <unordered_map> 201 #include <unordered_set> 202 #include <utility> 203 #include <valarray> 204 #include <variant> 205 #include <vector> 206 #include <version> 207 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 208 # include <wchar.h> 209 #endif 210 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 211 # include <wctype.h> 212 #endif 213 #if __cplusplus >= 201103L 214 # include <experimental/algorithm> 215 #endif 216 #if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) 217 # include <experimental/coroutine> 218 #endif 219 #if __cplusplus >= 201103L 220 # include <experimental/deque> 221 #endif 222 #if __cplusplus >= 201103L 223 # include <experimental/forward_list> 224 #endif 225 #if __cplusplus >= 201103L 226 # include <experimental/functional> 227 #endif 228 #if __cplusplus >= 201103L 229 # include <experimental/iterator> 230 #endif 231 #if __cplusplus >= 201103L 232 # include <experimental/list> 233 #endif 234 #if __cplusplus >= 201103L 235 # include <experimental/map> 236 #endif 237 #if __cplusplus >= 201103L 238 # include <experimental/memory_resource> 239 #endif 240 #if __cplusplus >= 201103L 241 # include <experimental/propagate_const> 242 #endif 243 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L 244 # include <experimental/regex> 245 #endif 246 #if __cplusplus >= 201103L 247 # include <experimental/set> 248 #endif 249 #if __cplusplus >= 201103L 250 # include <experimental/simd> 251 #endif 252 #if __cplusplus >= 201103L 253 # include <experimental/string> 254 #endif 255 #if __cplusplus >= 201103L 256 # include <experimental/type_traits> 257 #endif 258 #if __cplusplus >= 201103L 259 # include <experimental/unordered_map> 260 #endif 261 #if __cplusplus >= 201103L 262 # include <experimental/unordered_set> 263 #endif 264 #if __cplusplus >= 201103L 265 # include <experimental/utility> 266 #endif 267 #if __cplusplus >= 201103L 268 # include <experimental/vector> 269 #endif 270 #include <ext/hash_map> 271 #include <ext/hash_set> 272 // GENERATED-MARKER 273 274 #if defined(WITH_MAIN) main(int,char **)275int main(int, char**) { return 0; } 276 #endif 277