S/390: Add static OSC breaker if necessary.
[official-gcc.git] / gcc / go / go-system.h
blobd348d5c533a553a9d1f18234cc71c3f69acd0b70
1 // go-system.h -- Go frontend inclusion of gcc header files -*- C++ -*-
2 // Copyright (C) 2009-2016 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 GO_SYSTEM_H
21 #define GO_SYSTEM_H
23 #include "config.h"
25 // These must be included before the #poison declarations in system.h.
27 #include <algorithm>
28 #include <string>
29 #include <list>
30 #include <map>
31 #include <set>
32 #include <vector>
33 #include <sstream>
35 #if defined(HAVE_UNORDERED_MAP)
37 # include <unordered_map>
38 # include <unordered_set>
40 # define Unordered_map(KEYTYPE, VALTYPE) \
41 std::unordered_map<KEYTYPE, VALTYPE>
43 # define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
44 std::unordered_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
46 # define Unordered_set(KEYTYPE) \
47 std::unordered_set<KEYTYPE>
49 # define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
50 std::unordered_set<KEYTYPE, HASHFN, EQFN>
52 #elif defined(HAVE_TR1_UNORDERED_MAP)
54 # include <tr1/unordered_map>
55 # include <tr1/unordered_set>
57 # define Unordered_map(KEYTYPE, VALTYPE) \
58 std::tr1::unordered_map<KEYTYPE, VALTYPE>
60 # define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
61 std::tr1::unordered_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
63 # define Unordered_set(KEYTYPE) \
64 std::tr1::unordered_set<KEYTYPE>
66 # define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
67 std::tr1::unordered_set<KEYTYPE, HASHFN, EQFN>
69 #elif defined(HAVE_EXT_HASH_MAP)
71 # include <ext/hash_map>
72 # include <ext/hash_set>
74 # define Unordered_map(KEYTYPE, VALTYPE) \
75 __gnu_cxx::hash_map<KEYTYPE, VALTYPE>
77 # define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
78 __gnu_cxx::hash_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
80 # define Unordered_set(KEYTYPE) \
81 __gnu_cxx::hash_set<KEYTYPE>
83 # define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
84 __gnu_cxx::hash_set<KEYTYPE, HASHFN, EQFN>
86 // Provide hash functions for strings and pointers.
88 namespace __gnu_cxx
91 template<>
92 struct hash<std::string>
94 size_t
95 operator()(std::string s) const
96 { return __stl_hash_string(s.c_str()); }
99 template<typename T>
100 struct hash<T*>
102 size_t
103 operator()(T* p) const
104 { return reinterpret_cast<size_t>(p); }
109 #else
111 # define Unordered_map(KEYTYPE, VALTYPE) \
112 std::map<KEYTYPE, VALTYPE>
114 # define Unordered_set(KEYTYPE) \
115 std::set<KEYTYPE>
117 // We could make this work by writing an adapter class which
118 // implemented operator< in terms of the hash function.
119 # error "requires hash table type"
121 #endif
123 // We don't really need iostream, but some versions of gmp.h include
124 // it when compiled with C++, which means that we need to include it
125 // before the macro magic of safe-ctype.h, which is included by
126 // system.h.
127 #include <iostream>
129 #include "system.h"
130 #include "ansidecl.h"
131 #include "coretypes.h"
133 #include "diagnostic-core.h" /* For error_at and friends. */
134 #include "intl.h" /* For _(). */
136 // When using gcc, go_assert is just gcc_assert.
137 #define go_assert(EXPR) gcc_assert(EXPR)
139 // When using gcc, go_unreachable is just gcc_unreachable.
140 #define go_unreachable() gcc_unreachable()
142 #endif // !defined(GO_SYSTEM_H)