]>
Commit | Line | Data |
---|---|---|
fe6264fa | 1 | // rust-system.h -- Rust frontend inclusion of gcc header files -*- C++ -*- |
a945c346 | 2 | // Copyright (C) 2009-2024 Free Software Foundation, Inc. |
fe6264fa PH |
3 | |
4 | // This file is part of GCC. | |
5 | ||
6 | // GCC is free software; you can redistribute it and/or modify it under | |
7 | // the terms of the GNU General Public License as published by the Free | |
8 | // Software Foundation; either version 3, or (at your option) any later | |
9 | // version. | |
10 | ||
11 | // GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | // for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License | |
17 | // along with GCC; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
20 | #ifndef RUST_SYSTEM_H | |
21 | #define RUST_SYSTEM_H | |
22 | ||
23 | #define INCLUDE_ALGORITHM | |
24 | #include "config.h" | |
25 | ||
26 | /* Define this so that inttypes.h defines the PRI?64 macros even | |
27 | when compiling with a C++ compiler. Define it here so in the | |
28 | event inttypes.h gets pulled in by another header it is already | |
29 | defined. */ | |
30 | #define __STDC_FORMAT_MACROS | |
31 | ||
32 | // These must be included before the #poison declarations in system.h. | |
33 | ||
34 | #include <string> | |
35 | #include <list> | |
36 | #include <map> | |
37 | #include <set> | |
38 | #include <vector> | |
39 | #include <sstream> | |
40 | #include <string> | |
41 | #include <deque> | |
42 | #include <functional> | |
43 | #include <memory> | |
44 | #include <utility> | |
45 | #include <fstream> | |
46 | ||
47 | // Rust frontend requires C++11 minimum, so will have unordered_map and set | |
48 | #include <unordered_map> | |
49 | #include <unordered_set> | |
50 | ||
51 | /* We don't really need iostream, but some versions of gmp.h include | |
52 | * it when compiled with C++, which means that we need to include it | |
53 | * before the macro magic of safe-ctype.h, which is included by | |
54 | * system.h. */ | |
55 | #include <iostream> | |
56 | ||
57 | #include "system.h" | |
58 | #include "ansidecl.h" | |
59 | #include "coretypes.h" | |
60 | ||
61 | #include "diagnostic-core.h" /* For error_at and friends. */ | |
62 | #include "intl.h" /* For _(). */ | |
63 | ||
64 | #define RUST_ATTRIBUTE_NORETURN ATTRIBUTE_NORETURN | |
65 | ||
66 | // File separator to use based on whether or not the OS we're working with is | |
67 | // DOS-based | |
68 | #if defined(HAVE_DOS_BASED_FILE_SYSTEM) | |
69 | constexpr static const char *file_separator = "\\"; | |
70 | #else | |
71 | constexpr static const char *file_separator = "/"; | |
72 | #endif /* HAVE_DOS_BASED_FILE_SYSTEM */ | |
73 | ||
74 | // When using gcc, rust_assert is just gcc_assert. | |
75 | #define rust_assert(EXPR) gcc_assert (EXPR) | |
76 | ||
77 | // When using gcc, rust_unreachable is just gcc_unreachable. | |
78 | #define rust_unreachable() gcc_unreachable () | |
79 | ||
80 | extern void | |
81 | rust_preserve_from_gc (tree t); | |
82 | ||
83 | extern const char * | |
84 | rust_localize_identifier (const char *ident); | |
85 | ||
86 | #endif // !defined(RUST_SYSTEM_H) |