annotate gcc/go/go-system.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // go-system.h -- Go frontend inclusion of gcc header files -*- C++ -*-
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 // Copyright (C) 2009-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 // This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 // GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 // the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 // Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 // version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 // for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 // You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 // along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 // <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #ifndef GO_SYSTEM_H
kono
parents:
diff changeset
21 #define GO_SYSTEM_H
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 #include "config.h"
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 /* Define this so that inttypes.h defines the PRI?64 macros even
kono
parents:
diff changeset
26 when compiling with a C++ compiler. Define it here so in the
kono
parents:
diff changeset
27 event inttypes.h gets pulled in by another header it is already
kono
parents:
diff changeset
28 defined. */
kono
parents:
diff changeset
29 #define __STDC_FORMAT_MACROS
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 // These must be included before the #poison declarations in system.h.
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 #include <algorithm>
kono
parents:
diff changeset
34 #include <string>
kono
parents:
diff changeset
35 #include <list>
kono
parents:
diff changeset
36 #include <map>
kono
parents:
diff changeset
37 #include <set>
kono
parents:
diff changeset
38 #include <vector>
kono
parents:
diff changeset
39 #include <sstream>
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 #if defined(HAVE_UNORDERED_MAP)
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 # include <unordered_map>
kono
parents:
diff changeset
44 # include <unordered_set>
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 # define Unordered_map(KEYTYPE, VALTYPE) \
kono
parents:
diff changeset
47 std::unordered_map<KEYTYPE, VALTYPE>
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 # define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
kono
parents:
diff changeset
50 std::unordered_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 # define Unordered_set(KEYTYPE) \
kono
parents:
diff changeset
53 std::unordered_set<KEYTYPE>
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 # define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
kono
parents:
diff changeset
56 std::unordered_set<KEYTYPE, HASHFN, EQFN>
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 #elif defined(HAVE_TR1_UNORDERED_MAP)
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 # include <tr1/unordered_map>
kono
parents:
diff changeset
61 # include <tr1/unordered_set>
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 # define Unordered_map(KEYTYPE, VALTYPE) \
kono
parents:
diff changeset
64 std::tr1::unordered_map<KEYTYPE, VALTYPE>
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 # define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
kono
parents:
diff changeset
67 std::tr1::unordered_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 # define Unordered_set(KEYTYPE) \
kono
parents:
diff changeset
70 std::tr1::unordered_set<KEYTYPE>
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 # define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
kono
parents:
diff changeset
73 std::tr1::unordered_set<KEYTYPE, HASHFN, EQFN>
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 #elif defined(HAVE_EXT_HASH_MAP)
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 # include <ext/hash_map>
kono
parents:
diff changeset
78 # include <ext/hash_set>
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 # define Unordered_map(KEYTYPE, VALTYPE) \
kono
parents:
diff changeset
81 __gnu_cxx::hash_map<KEYTYPE, VALTYPE>
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 # define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
kono
parents:
diff changeset
84 __gnu_cxx::hash_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 # define Unordered_set(KEYTYPE) \
kono
parents:
diff changeset
87 __gnu_cxx::hash_set<KEYTYPE>
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 # define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
kono
parents:
diff changeset
90 __gnu_cxx::hash_set<KEYTYPE, HASHFN, EQFN>
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 // Provide hash functions for strings and pointers.
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 namespace __gnu_cxx
kono
parents:
diff changeset
95 {
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 template<>
kono
parents:
diff changeset
98 struct hash<std::string>
kono
parents:
diff changeset
99 {
kono
parents:
diff changeset
100 size_t
kono
parents:
diff changeset
101 operator()(std::string s) const
kono
parents:
diff changeset
102 { return __stl_hash_string(s.c_str()); }
kono
parents:
diff changeset
103 };
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 template<typename T>
kono
parents:
diff changeset
106 struct hash<T*>
kono
parents:
diff changeset
107 {
kono
parents:
diff changeset
108 size_t
kono
parents:
diff changeset
109 operator()(T* p) const
kono
parents:
diff changeset
110 { return reinterpret_cast<size_t>(p); }
kono
parents:
diff changeset
111 };
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 }
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 #else
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 # define Unordered_map(KEYTYPE, VALTYPE) \
kono
parents:
diff changeset
118 std::map<KEYTYPE, VALTYPE>
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 # define Unordered_set(KEYTYPE) \
kono
parents:
diff changeset
121 std::set<KEYTYPE>
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 // We could make this work by writing an adapter class which
kono
parents:
diff changeset
124 // implemented operator< in terms of the hash function.
kono
parents:
diff changeset
125 # error "requires hash table type"
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 #endif
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 // We don't really need iostream, but some versions of gmp.h include
kono
parents:
diff changeset
130 // it when compiled with C++, which means that we need to include it
kono
parents:
diff changeset
131 // before the macro magic of safe-ctype.h, which is included by
kono
parents:
diff changeset
132 // system.h.
kono
parents:
diff changeset
133 #include <iostream>
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 #include "system.h"
kono
parents:
diff changeset
136 #include "ansidecl.h"
kono
parents:
diff changeset
137 #include "coretypes.h"
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 #include "diagnostic-core.h" /* For error_at and friends. */
kono
parents:
diff changeset
140 #include "intl.h" /* For _(). */
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 // When using gcc, go_assert is just gcc_assert.
kono
parents:
diff changeset
143 #define go_assert(EXPR) gcc_assert(EXPR)
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 // When using gcc, go_unreachable is just gcc_unreachable.
kono
parents:
diff changeset
146 #define go_unreachable() gcc_unreachable()
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 #endif // !defined(GO_SYSTEM_H)