libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / rust / rust-system.h
blob2382e5b1fb4e28eae5c5b067fefdd6102d836991
1 // rust-system.h -- Rust frontend inclusion of gcc header files -*- C++ -*-
2 // Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 // This file is part of GCC.
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.
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.
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/>.
20 #ifndef RUST_SYSTEM_H
21 #define RUST_SYSTEM_H
23 #define INCLUDE_ALGORITHM
24 #include "config.h"
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
32 // These must be included before the #poison declarations in system.h.
34 #include <string>
35 #include <list>
36 #include <map>
37 #include <set>
38 #include <vector>
39 #include <stack>
40 #include <sstream>
41 #include <string>
42 #include <deque>
43 #include <functional>
44 #include <memory>
45 #include <utility>
46 #include <fstream>
47 #include <array>
48 #include <algorithm>
49 #include <limits>
50 #include <numeric>
52 // Rust frontend requires C++11 minimum, so will have unordered_map and set
53 #include <unordered_map>
54 #include <unordered_set>
56 /* We don't really need iostream, but some versions of gmp.h include
57 * it when compiled with C++, which means that we need to include it
58 * before the macro magic of safe-ctype.h, which is included by
59 * system.h. */
60 #include <iostream>
61 #include <iomanip>
63 #include "system.h"
64 #include "ansidecl.h"
65 #include "coretypes.h"
67 #include "diagnostic-core.h" /* For error_at and friends. */
68 #include "intl.h" /* For _(). */
70 #define RUST_ATTRIBUTE_NORETURN ATTRIBUTE_NORETURN
72 // File separator to use based on whether or not the OS we're working with is
73 // DOS-based
74 #if defined(HAVE_DOS_BASED_FILE_SYSTEM)
75 constexpr static const char *file_separator = "\\";
76 #else
77 constexpr static const char *file_separator = "/";
78 #endif /* HAVE_DOS_BASED_FILE_SYSTEM */
80 // When using gcc, rust_assert is just gcc_assert.
81 #define rust_assert(EXPR) gcc_assert (EXPR)
83 /**
84 * rust_unreachable is just a fancy abort which causes an internal compiler
85 * error. This macro is not equivalent to `__builtin_unreachable` and does not
86 * indicate optimizations for the compiler
88 #define rust_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
90 extern void
91 rust_preserve_from_gc (tree t);
93 extern const char *
94 rust_localize_identifier (const char *ident);
96 #endif // !defined(RUST_SYSTEM_H)