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 // Prevent <ext/hash_map> from generating deprecated warnings for this test. 17 #if defined(__DEPRECATED) 18 # undef __DEPRECATED 19 #endif 20 21 /* 22 BEGIN-SCRIPT 23 24 for header in public_headers: 25 print("{}#{}include <{}>{}".format( 26 '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', 27 3 * ' ' if header in header_restrictions else '', 28 header, 29 '\n#endif' if header in header_restrictions else '' 30 )) 31 32 END-SCRIPT 33 */ 34 35 // DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW 36 // GENERATED-MARKER 37 #include <algorithm> 38 #include <any> 39 #include <array> 40 #include <atomic> 41 #if !defined(_LIBCPP_HAS_NO_THREADS) 42 # include <barrier> 43 #endif 44 #include <bit> 45 #include <bitset> 46 #include <cassert> 47 #include <ccomplex> 48 #include <cctype> 49 #include <cerrno> 50 #include <cfenv> 51 #include <cfloat> 52 #include <charconv> 53 #include <chrono> 54 #include <cinttypes> 55 #include <ciso646> 56 #include <climits> 57 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 58 # include <clocale> 59 #endif 60 #include <cmath> 61 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 62 # include <codecvt> 63 #endif 64 #include <compare> 65 #include <complex> 66 #include <complex.h> 67 #include <concepts> 68 #include <condition_variable> 69 #if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) 70 # include <coroutine> 71 #endif 72 #include <csetjmp> 73 #include <csignal> 74 #include <cstdarg> 75 #include <cstdbool> 76 #include <cstddef> 77 #include <cstdint> 78 #include <cstdio> 79 #include <cstdlib> 80 #include <cstring> 81 #include <ctgmath> 82 #include <ctime> 83 #include <ctype.h> 84 #include <cuchar> 85 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 86 # include <cwchar> 87 #endif 88 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 89 # include <cwctype> 90 #endif 91 #include <deque> 92 #include <errno.h> 93 #include <exception> 94 #include <execution> 95 #include <expected> 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) && !defined(_LIBCPP_HAS_NO_FSTREAM) 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 #include <memory_resource> 142 #if !defined(_LIBCPP_HAS_NO_THREADS) 143 # include <mutex> 144 #endif 145 #include <new> 146 #include <numbers> 147 #include <numeric> 148 #include <optional> 149 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 150 # include <ostream> 151 #endif 152 #include <queue> 153 #include <random> 154 #include <ranges> 155 #include <ratio> 156 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 157 # include <regex> 158 #endif 159 #include <scoped_allocator> 160 #if !defined(_LIBCPP_HAS_NO_THREADS) 161 # include <semaphore> 162 #endif 163 #include <set> 164 #include <setjmp.h> 165 #if !defined(_LIBCPP_HAS_NO_THREADS) 166 # include <shared_mutex> 167 #endif 168 #include <source_location> 169 #include <span> 170 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 171 # include <sstream> 172 #endif 173 #include <stack> 174 #if __cplusplus > 202002L && !defined(_LIBCPP_HAS_NO_THREADS) 175 # include <stdatomic.h> 176 #endif 177 #include <stdbool.h> 178 #include <stddef.h> 179 #include <stdexcept> 180 #include <stdint.h> 181 #include <stdio.h> 182 #include <stdlib.h> 183 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 184 # include <streambuf> 185 #endif 186 #include <string> 187 #include <string.h> 188 #include <string_view> 189 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 190 # include <strstream> 191 #endif 192 #include <system_error> 193 #include <tgmath.h> 194 #if !defined(_LIBCPP_HAS_NO_THREADS) 195 # include <thread> 196 #endif 197 #include <tuple> 198 #include <type_traits> 199 #include <typeindex> 200 #include <typeinfo> 201 #include <uchar.h> 202 #include <unordered_map> 203 #include <unordered_set> 204 #include <utility> 205 #include <valarray> 206 #include <variant> 207 #include <vector> 208 #include <version> 209 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 210 # include <wchar.h> 211 #endif 212 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 213 # include <wctype.h> 214 #endif 215 #if __cplusplus >= 201103L 216 # include <experimental/deque> 217 #endif 218 #if __cplusplus >= 201103L 219 # include <experimental/forward_list> 220 #endif 221 #if __cplusplus >= 201103L 222 # include <experimental/iterator> 223 #endif 224 #if __cplusplus >= 201103L 225 # include <experimental/list> 226 #endif 227 #if __cplusplus >= 201103L 228 # include <experimental/map> 229 #endif 230 #if __cplusplus >= 201103L 231 # include <experimental/memory_resource> 232 #endif 233 #if __cplusplus >= 201103L 234 # include <experimental/propagate_const> 235 #endif 236 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L 237 # include <experimental/regex> 238 #endif 239 #if __cplusplus >= 201103L 240 # include <experimental/set> 241 #endif 242 #if __cplusplus >= 201103L 243 # include <experimental/simd> 244 #endif 245 #if __cplusplus >= 201103L 246 # include <experimental/string> 247 #endif 248 #if __cplusplus >= 201103L 249 # include <experimental/type_traits> 250 #endif 251 #if __cplusplus >= 201103L 252 # include <experimental/unordered_map> 253 #endif 254 #if __cplusplus >= 201103L 255 # include <experimental/unordered_set> 256 #endif 257 #if __cplusplus >= 201103L 258 # include <experimental/utility> 259 #endif 260 #if __cplusplus >= 201103L 261 # include <experimental/vector> 262 #endif 263 #include <ext/hash_map> 264 #include <ext/hash_set> 265 // GENERATED-MARKER 266 267 #if defined(WITH_MAIN) main(int,char **)268int main(int, char**) { return 0; } 269 #endif 270