]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/ia64/ia64-c.c
2015-06-04 Andrew MacLeod <amacleod@redhat.com>
[thirdparty/gcc.git] / gcc / config / ia64 / ia64-c.c
1 /* Definitions of C specific functions for GNU compiler.
2 Copyright (C) 2002-2015 Free Software Foundation, Inc.
3 Contributed by Steve Ellcey <sje@cup.hp.com>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "hash-set.h"
26 #include "vec.h"
27 #include "input.h"
28 #include "alias.h"
29 #include "symtab.h"
30 #include "inchash.h"
31 #include "tree.h"
32 #include "stringpool.h"
33 #include "cpplib.h"
34 #include "c-family/c-common.h"
35 #include "c-family/c-pragma.h"
36 #include "diagnostic-core.h"
37 #include "tm_p.h"
38
39 static void ia64_hpux_add_pragma_builtin (tree func);
40
41 void
42 ia64_hpux_handle_builtin_pragma (cpp_reader *pfile ATTRIBUTE_UNUSED)
43 {
44 /* #pragma builtin name, name, name */
45
46 enum cpp_ttype type;
47 tree x;
48
49 type = pragma_lex (&x);
50 while (type == CPP_NAME)
51 {
52 ia64_hpux_add_pragma_builtin (x);
53 type = pragma_lex (&x);
54 if (type == CPP_COMMA)
55 type = pragma_lex (&x);
56 }
57 if (type != CPP_EOF)
58 warning (OPT_Wpragmas, "malformed #pragma builtin");
59 }
60
61 /* List of standard math functions which do not set matherr by default
62 and which have a different version which does set errno and which we
63 want to call *if* we have seen an extern for the routine and we have
64 asked for strict C89 compatibility. */
65
66 typedef struct c89_mathlib_names
67 {
68 const char *realname; /* User visible function name. */
69 const char *c89name; /* libm special name needed to set errno. */
70 } c89_mathlib_names;
71
72 static const c89_mathlib_names c89_mathlib_name_list [] =
73 {
74 {"acos", "_Acos_e#"},
75 {"acosd", "_Acosd_e#"},
76 {"acosdf", "_Acosdf_e#"},
77 {"acosdl", "_Acosdl_e#"},
78 {"acosdw", "_Acosdw_e#"},
79 {"acosf", "_Acosf_e#"},
80 {"acosh", "_Acosh_e#"},
81 {"acoshf", "_Acoshf_e#"},
82 {"acoshl", "_Acoshl_e#"},
83 {"acoshw", "_Acoshw_e#"},
84 {"acosl", "_Acosl_e#"},
85 {"acosw", "_Acosw_e#"},
86 {"asin", "_Asin_e#"},
87 {"asind", "_Asind_e#"},
88 {"asindf", "_Asindf_e#"},
89 {"asindl", "_Asindl_e#"},
90 {"asindw", "_Asindw_e#"},
91 {"asinf", "_Asinf_e#"},
92 {"asinl", "_Asinl_e#"},
93 {"asinw", "_Asinw_e#"},
94 {"atanh", "_Atanh_e#"},
95 {"atanhf", "_Atanhf_e#"},
96 {"atanhl", "_Atanhl_e#"},
97 {"atanhw", "_Atanhw_e#"},
98 {"cosh", "_Cosh_e#"},
99 {"coshf", "_Coshf_e#"},
100 {"coshl", "_Coshl_e#"},
101 {"coshw", "_Coshw_e#"},
102 {"exp2", "_Exp2_e#"},
103 {"exp2f", "_Exp2f_e#"},
104 {"exp2l", "_Exp2l_e#"},
105 {"exp2w", "_Exp2w_e#"},
106 {"exp", "_Exp_e#"},
107 {"expf", "_Expf_e#"},
108 {"expl", "_Expl_e#"},
109 {"expm1", "_Expm1_e#"},
110 {"expm1f", "_Expm1f_e#"},
111 {"expm1l", "_Expm1l_e#"},
112 {"expm1w", "_Expm1w_e#"},
113 {"expw", "_Expw_e#"},
114 {"fmod", "_Fmod_e#"},
115 {"fmodf", "_Fmodf_e#"},
116 {"fmodl", "_Fmodl_e#"},
117 {"fmodw", "_Fmodw_e#"},
118 {"gamma", "_Gamma_e#"},
119 {"gammaf", "_Gammaf_e#"},
120 {"gammal", "_Gammal_e#"},
121 {"gammaw", "_Gammaw_e#"},
122 {"ldexp", "_Ldexp_e#"},
123 {"ldexpf", "_Ldexpf_e#"},
124 {"ldexpl", "_Ldexpl_e#"},
125 {"ldexpw", "_Ldexpw_e#"},
126 {"lgamma", "_Lgamma_e#"},
127 {"lgammaf", "_Lgammaf_e#"},
128 {"lgammal", "_Lgammal_e#"},
129 {"lgammaw", "_Lgammaw_e#"},
130 {"log10", "_Log10_e#"},
131 {"log10f", "_Log10f_e#"},
132 {"log10l", "_Log10l_e#"},
133 {"log10w", "_Log10w_e#"},
134 {"log1p", "_Log1p_e#"},
135 {"log1pf", "_Log1pf_e#"},
136 {"log1pl", "_Log1pl_e#"},
137 {"log1pw", "_Log1pw_e#"},
138 {"log2", "_Log2_e#"},
139 {"log2f", "_Log2f_e#"},
140 {"log2l", "_Log2l_e#"},
141 {"log2w", "_Log2w_e#"},
142 {"log", "_Log_e#"},
143 {"logb", "_Logb_e#"},
144 {"logbf", "_Logbf_e#"},
145 {"logbl", "_Logbl_e#"},
146 {"logbw", "_Logbw_e#"},
147 {"logf", "_Logf_e#"},
148 {"logl", "_Logl_e#"},
149 {"logw", "_Logw_e#"},
150 {"nextafter", "_Nextafter_e#"},
151 {"nextafterf", "_Nextafterf_e#"},
152 {"nextafterl", "_Nextafterl_e#"},
153 {"nextafterw", "_Nextafterw_e#"},
154 {"pow", "_Pow_e#"},
155 {"powf", "_Powf_e#"},
156 {"powl", "_Powl_e#"},
157 {"poww", "_Poww_e#"},
158 {"remainder", "_Remainder_e#"},
159 {"remainderf", "_Remainderf_e#"},
160 {"remainderl", "_Remainderl_e#"},
161 {"remainderw", "_Remainderw_e#"},
162 {"scalb", "_Scalb_e#"},
163 {"scalbf", "_Scalbf_e#"},
164 {"scalbl", "_Scalbl_e#"},
165 {"scalbw", "_Scalbw_e#"},
166 {"sinh", "_Sinh_e#"},
167 {"sinhf", "_Sinhf_e#"},
168 {"sinhl", "_Sinhl_e#"},
169 {"sinhw", "_Sinhw_e#"},
170 {"sqrt", "_Sqrt_e#"},
171 {"sqrtf", "_Sqrtf_e#"},
172 {"sqrtl", "_Sqrtl_e#"},
173 {"sqrtw", "_Sqrtw_e#"},
174 {"tgamma", "_Tgamma_e#"},
175 {"tgammaf", "_Tgammaf_e#"},
176 {"tgammal", "_Tgammal_e#"},
177 {"tgammaw", "_Tgammaw_e#"}
178 };
179
180 static void
181 ia64_hpux_add_pragma_builtin (tree func)
182 {
183 size_t i;
184
185 if (!flag_isoc94 && flag_iso)
186 {
187 for (i = 0; i < ARRAY_SIZE (c89_mathlib_name_list); i++)
188 {
189 if (!strcmp(c89_mathlib_name_list[i].realname,
190 IDENTIFIER_POINTER (func)))
191 {
192 add_to_renaming_pragma_list(func,
193 get_identifier(c89_mathlib_name_list[i].c89name));
194 }
195 }
196 }
197 }