aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-system.h
blob: a711fdc82f03f98f9eae965bc8432ff0f94fe616 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// rust-system.h -- Rust frontend inclusion of gcc header files   -*- C++ -*-
// Copyright (C) 2009-2020 Free Software Foundation, Inc.

// This file is part of GCC.

// GCC is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3, or (at your option) any later
// version.

// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.

// You should have received a copy of the GNU General Public License
// along with GCC; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

#ifndef RUST_SYSTEM_H
#define RUST_SYSTEM_H

#include "config.h"

/* Define this so that inttypes.h defines the PRI?64 macros even
   when compiling with a C++ compiler.  Define it here so in the
   event inttypes.h gets pulled in by another header it is already
   defined.  */
#define __STDC_FORMAT_MACROS

// These must be included before the #poison declarations in system.h.

#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <sstream>
#include <string>
#include <deque>
#include <functional>

// Rust frontend requires C++11 minimum, so will have unordered_map and set
#include <unordered_map>
#include <unordered_set>

/* We don't really need iostream, but some versions of gmp.h include
 * it when compiled with C++, which means that we need to include it
 * before the macro magic of safe-ctype.h, which is included by
 * system.h. */
#include <iostream>

#include "system.h"
#include "ansidecl.h"
#include "coretypes.h"

#include "diagnostic-core.h" /* For error_at and friends.  */
#include "intl.h"	    /* For _().  */

// When using gcc, rust_assert is just gcc_assert.
#define rust_assert(EXPR) gcc_assert (EXPR)

// When using gcc, rust_unreachable is just gcc_unreachable.
#define rust_unreachable() gcc_unreachable ()

extern void
rust_preserve_from_gc (tree t);

extern const char *
rust_localize_identifier (const char *ident);

#endif // !defined(RUST_SYSTEM_H)