OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [go/] [go-system.h] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 714 jeremybenn
// go-system.h -- Go frontend inclusion of gcc header files   -*- C++ -*-
2
// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
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 GO_SYSTEM_H
21
#define GO_SYSTEM_H
22
 
23
#include "config.h"
24
 
25
// These must be included before the #poison declarations in system.h.
26
 
27
#include <algorithm>
28
#include <string>
29
#include <list>
30
#include <map>
31
#include <set>
32
#include <vector>
33
 
34
#if defined(HAVE_UNORDERED_MAP)
35
 
36
# include <unordered_map>
37
# include <unordered_set>
38
 
39
# define Unordered_map(KEYTYPE, VALTYPE) \
40
        std::unordered_map<KEYTYPE, VALTYPE>
41
 
42
# define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
43
        std::unordered_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
44
 
45
# define Unordered_set(KEYTYPE) \
46
        std::unordered_set<KEYTYPE>
47
 
48
# define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
49
        std::unordered_set<KEYTYPE, HASHFN, EQFN>
50
 
51
#elif defined(HAVE_TR1_UNORDERED_MAP)
52
 
53
# include <tr1/unordered_map>
54
# include <tr1/unordered_set>
55
 
56
# define Unordered_map(KEYTYPE, VALTYPE) \
57
        std::tr1::unordered_map<KEYTYPE, VALTYPE>
58
 
59
# define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
60
        std::tr1::unordered_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
61
 
62
# define Unordered_set(KEYTYPE) \
63
        std::tr1::unordered_set<KEYTYPE>
64
 
65
# define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
66
        std::tr1::unordered_set<KEYTYPE, HASHFN, EQFN>
67
 
68
#elif defined(HAVE_EXT_HASH_MAP)
69
 
70
# include <ext/hash_map>
71
# include <ext/hash_set>
72
 
73
# define Unordered_map(KEYTYPE, VALTYPE) \
74
        __gnu_cxx::hash_map<KEYTYPE, VALTYPE>
75
 
76
# define Unordered_map_hash(KEYTYPE, VALTYPE, HASHFN, EQFN) \
77
        __gnu_cxx::hash_map<KEYTYPE, VALTYPE, HASHFN, EQFN>
78
 
79
# define Unordered_set(KEYTYPE) \
80
        __gnu_cxx::hash_set<KEYTYPE>
81
 
82
# define Unordered_set_hash(KEYTYPE, HASHFN, EQFN) \
83
        __gnu_cxx::hash_set<KEYTYPE, HASHFN, EQFN>
84
 
85
// Provide hash functions for strings and pointers.
86
 
87
namespace __gnu_cxx
88
{
89
 
90
template<>
91
struct hash<std::string>
92
{
93
  size_t
94
  operator()(std::string s) const
95
  { return __stl_hash_string(s.c_str()); }
96
};
97
 
98
template<typename T>
99
struct hash<T*>
100
{
101
  size_t
102
  operator()(T* p) const
103
  { return reinterpret_cast<size_t>(p); }
104
};
105
 
106
}
107
 
108
#else
109
 
110
# define Unordered_map(KEYTYPE, VALTYPE) \
111
        std::map<KEYTYPE, VALTYPE>
112
 
113
# define Unordered_set(KEYTYPE) \
114
        std::set<KEYTYPE>
115
 
116
// We could make this work by writing an adapter class which
117
// implemented operator< in terms of the hash function.
118
# error "requires hash table type"
119
 
120
#endif
121
 
122
// We don't really need iostream, but some versions of gmp.h include
123
// it when compiled with C++, which means that we need to include it
124
// before the macro magic of safe-ctype.h, which is included by
125
// system.h.
126
#include <iostream>
127
 
128
// Some versions of gmp.h assume that #include <iostream> will define
129
// std::FILE.  This is not true with libstdc++ 4.3 and later.  This is
130
// fixed in GMP 4.3, but at this point we don't know which version of
131
// GMP is in use.  Since the top level configure script accepts GMP
132
// 4.2, at least for now we #include <cstdio> to ensure that GMP 4.2
133
// will work.  FIXME: This can be removed when we require GMP 4.3 or
134
// later.
135
#include <cstdio>
136
 
137
#ifndef ENABLE_BUILD_WITH_CXX
138
extern "C"
139
{
140
#endif
141
 
142
#include "system.h"
143
#include "ansidecl.h"
144
#include "coretypes.h"
145
 
146
#include "diagnostic-core.h"    /* For error_at and friends.  */
147
#include "input.h"              /* For source_location.  */
148
#include "intl.h"               /* For _().  */
149
 
150
#ifndef ENABLE_BUILD_WITH_CXX
151
} // End extern "C"
152
#endif
153
 
154
// When using gcc, go_assert is just gcc_assert.
155
#define go_assert(EXPR) gcc_assert(EXPR)
156
 
157
// When using gcc, go_unreachable is just gcc_unreachable.
158
#define go_unreachable() gcc_unreachable()
159
 
160
#endif // !defined(GO_SYSTEM_H)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.