Commit | Line | Data |
---|---|---|
bae7f79e ILT |
1 | // gold.h -- general definitions for gold -*- C++ -*- |
2 | ||
3 | #ifndef GOLD_GOLD_H | |
4 | ||
5 | #include "config.h" | |
6 | #include "ansidecl.h" | |
7 | ||
8 | #ifdef ENABLE_NLS | |
9 | # include <libintl.h> | |
10 | # define _(String) gettext (String) | |
11 | # ifdef gettext_noop | |
12 | # define N_(String) gettext_noop (String) | |
13 | # else | |
14 | # define N_(String) (String) | |
15 | # endif | |
16 | #else | |
17 | # define gettext(Msgid) (Msgid) | |
18 | # define dgettext(Domainname, Msgid) (Msgid) | |
19 | # define dcgettext(Domainname, Msgid, Category) (Msgid) | |
20 | # define textdomain(Domainname) while (0) /* nothing */ | |
21 | # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ | |
22 | # define _(String) (String) | |
23 | # define N_(String) (String) | |
24 | #endif | |
25 | ||
54dc6425 ILT |
26 | // Figure out how to get a hash set and a hash map. |
27 | ||
d288e464 | 28 | #if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) |
bae7f79e ILT |
29 | |
30 | #include <tr1/unordered_set> | |
31 | #include <tr1/unordered_map> | |
32 | ||
33 | // We need a template typedef here. | |
34 | ||
35 | #define Unordered_set std::tr1::unordered_set | |
36 | #define Unordered_map std::tr1::unordered_map | |
37 | ||
d288e464 | 38 | #elif defined(HAVE_EXT_HASH_MAP) && defined(HAVE_EXT_HASH_SET) |
54dc6425 ILT |
39 | |
40 | #include <ext/hash_map> | |
41 | #include <ext/hash_set> | |
274e99f9 | 42 | #include <string> |
54dc6425 ILT |
43 | |
44 | #define Unordered_set __gnu_cxx::hash_set | |
45 | #define Unordered_map __gnu_cxx::hash_map | |
46 | ||
274e99f9 ILT |
47 | namespace __gnu_cxx |
48 | { | |
49 | ||
50 | template<> | |
51 | struct hash<std::string> | |
52 | { | |
53 | size_t | |
54 | operator()(std::string s) const | |
55 | { return __stl_hash_string(s.c_str()); } | |
56 | }; | |
57 | ||
58 | template<typename T> | |
59 | struct hash<T*> | |
60 | { | |
61 | size_t | |
62 | operator()(T* p) const | |
63 | { return reinterpret_cast<size_t>(p); } | |
64 | }; | |
65 | ||
66 | } | |
67 | ||
54dc6425 ILT |
68 | #else |
69 | ||
70 | // The fallback is to just use set and map. | |
71 | ||
72 | #include <set> | |
73 | #include <map> | |
74 | ||
75 | #define Unordered_set std::set | |
76 | #define Unordered_map std::map | |
77 | ||
78 | #endif | |
79 | ||
bae7f79e ILT |
80 | namespace gold |
81 | { | |
82 | ||
61ba1cf9 ILT |
83 | class General_options; |
84 | class Input_objects; | |
85 | class Symbol_table; | |
86 | class Layout; | |
87 | class Workqueue; | |
88 | class Output_file; | |
89 | ||
bae7f79e ILT |
90 | // The name of the program as used in error messages. |
91 | extern const char* program_name; | |
92 | ||
93 | // This function is called to exit the program. Status is true to | |
94 | // exit success (0) and false to exit failure (1). | |
95 | extern void | |
96 | gold_exit(bool status) ATTRIBUTE_NORETURN; | |
97 | ||
98 | // This function is called to emit an unexpected error message and a | |
99 | // newline, and then exit with failure. If PERRNO is true, it reports | |
100 | // the error in errno. | |
101 | extern void | |
102 | gold_fatal(const char* msg, bool perrno) ATTRIBUTE_NORETURN; | |
103 | ||
104 | // This is function is called in some cases if we run out of memory. | |
105 | extern void | |
106 | gold_nomem() ATTRIBUTE_NORETURN; | |
107 | ||
108 | // This function is called in cases which can not arise if the code is | |
109 | // written correctly. | |
110 | extern void | |
111 | gold_unreachable() ATTRIBUTE_NORETURN; | |
112 | ||
61ba1cf9 ILT |
113 | extern void |
114 | queue_final_tasks(const General_options&, | |
115 | const Input_objects*, | |
116 | const Symbol_table*, | |
117 | const Layout*, | |
118 | Workqueue*, | |
119 | Output_file* of); | |
120 | ||
bae7f79e ILT |
121 | } // End namespace gold. |
122 | ||
123 | #endif // !defined(GOLD_GOLD_H) |