]>
Commit | Line | Data |
---|---|---|
16a1895e | 1 | /* C++ specific Solaris system support. |
d353bf18 | 2 | Copyright (C) 2011-2015 Free Software Foundation, Inc. |
16a1895e | 3 | |
4 | This file is part of GCC. | |
5 | ||
6 | GCC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GCC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License 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 | #include "config.h" | |
21 | #include "system.h" | |
22 | #include "coretypes.h" | |
b20a8bb4 | 23 | #include "alias.h" |
24 | #include "symtab.h" | |
25 | #include "options.h" | |
16a1895e | 26 | #include "tree.h" |
9ed99284 | 27 | #include "stringpool.h" |
16a1895e | 28 | #include "cp/cp-tree.h" |
29 | #include "tm.h" | |
30 | #include "tm_p.h" | |
31 | ||
32 | /* Before GCC 4.7, g++ defined __cplusplus 1 to avoid coping with the C++98 | |
33 | overloads in Solaris system headers. Since this was fixed, 4 structure | |
34 | types would move to namespace std, breaking the Solaris libstdc++ ABI. | |
35 | To avoid this, we forcefully keep those types in the global namespace. | |
36 | This can be removed once the next major version of libstdc++ is | |
37 | released. */ | |
38 | ||
39 | /* Cache the identifiers of the affected types to speed up lookup. */ | |
40 | #define NUM_FGID 4 | |
41 | static GTY(()) tree force_global_identifiers[NUM_FGID]; | |
42 | ||
43 | /* Check if DECL is one of the affected types and move it to the global | |
44 | namespace if so. */ | |
45 | tree | |
46 | solaris_cxx_decl_mangling_context (const_tree decl) | |
47 | { | |
48 | static bool init = false; | |
49 | int i = 0; | |
50 | ||
51 | if (!init) | |
52 | { | |
53 | force_global_identifiers[i++] = get_identifier ("div_t"); | |
54 | force_global_identifiers[i++] = get_identifier ("ldiv_t"); | |
55 | force_global_identifiers[i++] = get_identifier ("lconv"); | |
56 | force_global_identifiers[i++] = get_identifier ("tm"); | |
57 | init = true; | |
58 | } | |
59 | ||
60 | if (!(DECL_P (decl) && DECL_NAMESPACE_STD_P (CP_DECL_CONTEXT (decl)))) | |
61 | return NULL_TREE; | |
62 | ||
63 | for (i = 0; i < NUM_FGID; i++) | |
64 | if (DECL_NAME (decl) == force_global_identifiers[i]) | |
65 | return global_namespace; | |
66 | ||
67 | return NULL_TREE; | |
68 | } |