]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/ia64/ia64-c.c
2015-06-17 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 "alias.h"
26 #include "symtab.h"
27 #include "tree.h"
28 #include "stringpool.h"
29 #include "cpplib.h"
30 #include "c-family/c-common.h"
31 #include "c-family/c-pragma.h"
32 #include "diagnostic-core.h"
33 #include "tm_p.h"
34
35 static void ia64_hpux_add_pragma_builtin (tree func);
36
37 void
38 ia64_hpux_handle_builtin_pragma (cpp_reader *pfile ATTRIBUTE_UNUSED)
39 {
40 /* #pragma builtin name, name, name */
41
42 enum cpp_ttype type;
43 tree x;
44
45 type = pragma_lex (&x);
46 while (type == CPP_NAME)
47 {
48 ia64_hpux_add_pragma_builtin (x);
49 type = pragma_lex (&x);
50 if (type == CPP_COMMA)
51 type = pragma_lex (&x);
52 }
53 if (type != CPP_EOF)
54 warning (OPT_Wpragmas, "malformed #pragma builtin");
55 }
56
57 /* List of standard math functions which do not set matherr by default
58 and which have a different version which does set errno and which we
59 want to call *if* we have seen an extern for the routine and we have
60 asked for strict C89 compatibility. */
61
62 typedef struct c89_mathlib_names
63 {
64 const char *realname; /* User visible function name. */
65 const char *c89name; /* libm special name needed to set errno. */
66 } c89_mathlib_names;
67
68 static const c89_mathlib_names c89_mathlib_name_list [] =
69 {
70 {"acos", "_Acos_e#"},
71 {"acosd", "_Acosd_e#"},
72 {"acosdf", "_Acosdf_e#"},
73 {"acosdl", "_Acosdl_e#"},
74 {"acosdw", "_Acosdw_e#"},
75 {"acosf", "_Acosf_e#"},
76 {"acosh", "_Acosh_e#"},
77 {"acoshf", "_Acoshf_e#"},
78 {"acoshl", "_Acoshl_e#"},
79 {"acoshw", "_Acoshw_e#"},
80 {"acosl", "_Acosl_e#"},
81 {"acosw", "_Acosw_e#"},
82 {"asin", "_Asin_e#"},
83 {"asind", "_Asind_e#"},
84 {"asindf", "_Asindf_e#"},
85 {"asindl", "_Asindl_e#"},
86 {"asindw", "_Asindw_e#"},
87 {"asinf", "_Asinf_e#"},
88 {"asinl", "_Asinl_e#"},
89 {"asinw", "_Asinw_e#"},
90 {"atanh", "_Atanh_e#"},
91 {"atanhf", "_Atanhf_e#"},
92 {"atanhl", "_Atanhl_e#"},
93 {"atanhw", "_Atanhw_e#"},
94 {"cosh", "_Cosh_e#"},
95 {"coshf", "_Coshf_e#"},
96 {"coshl", "_Coshl_e#"},
97 {"coshw", "_Coshw_e#"},
98 {"exp2", "_Exp2_e#"},
99 {"exp2f", "_Exp2f_e#"},
100 {"exp2l", "_Exp2l_e#"},
101 {"exp2w", "_Exp2w_e#"},
102 {"exp", "_Exp_e#"},
103 {"expf", "_Expf_e#"},
104 {"expl", "_Expl_e#"},
105 {"expm1", "_Expm1_e#"},
106 {"expm1f", "_Expm1f_e#"},
107 {"expm1l", "_Expm1l_e#"},
108 {"expm1w", "_Expm1w_e#"},
109 {"expw", "_Expw_e#"},
110 {"fmod", "_Fmod_e#"},
111 {"fmodf", "_Fmodf_e#"},
112 {"fmodl", "_Fmodl_e#"},
113 {"fmodw", "_Fmodw_e#"},
114 {"gamma", "_Gamma_e#"},
115 {"gammaf", "_Gammaf_e#"},
116 {"gammal", "_Gammal_e#"},
117 {"gammaw", "_Gammaw_e#"},
118 {"ldexp", "_Ldexp_e#"},
119 {"ldexpf", "_Ldexpf_e#"},
120 {"ldexpl", "_Ldexpl_e#"},
121 {"ldexpw", "_Ldexpw_e#"},
122 {"lgamma", "_Lgamma_e#"},
123 {"lgammaf", "_Lgammaf_e#"},
124 {"lgammal", "_Lgammal_e#"},
125 {"lgammaw", "_Lgammaw_e#"},
126 {"log10", "_Log10_e#"},
127 {"log10f", "_Log10f_e#"},
128 {"log10l", "_Log10l_e#"},
129 {"log10w", "_Log10w_e#"},
130 {"log1p", "_Log1p_e#"},
131 {"log1pf", "_Log1pf_e#"},
132 {"log1pl", "_Log1pl_e#"},
133 {"log1pw", "_Log1pw_e#"},
134 {"log2", "_Log2_e#"},
135 {"log2f", "_Log2f_e#"},
136 {"log2l", "_Log2l_e#"},
137 {"log2w", "_Log2w_e#"},
138 {"log", "_Log_e#"},
139 {"logb", "_Logb_e#"},
140 {"logbf", "_Logbf_e#"},
141 {"logbl", "_Logbl_e#"},
142 {"logbw", "_Logbw_e#"},
143 {"logf", "_Logf_e#"},
144 {"logl", "_Logl_e#"},
145 {"logw", "_Logw_e#"},
146 {"nextafter", "_Nextafter_e#"},
147 {"nextafterf", "_Nextafterf_e#"},
148 {"nextafterl", "_Nextafterl_e#"},
149 {"nextafterw", "_Nextafterw_e#"},
150 {"pow", "_Pow_e#"},
151 {"powf", "_Powf_e#"},
152 {"powl", "_Powl_e#"},
153 {"poww", "_Poww_e#"},
154 {"remainder", "_Remainder_e#"},
155 {"remainderf", "_Remainderf_e#"},
156 {"remainderl", "_Remainderl_e#"},
157 {"remainderw", "_Remainderw_e#"},
158 {"scalb", "_Scalb_e#"},
159 {"scalbf", "_Scalbf_e#"},
160 {"scalbl", "_Scalbl_e#"},
161 {"scalbw", "_Scalbw_e#"},
162 {"sinh", "_Sinh_e#"},
163 {"sinhf", "_Sinhf_e#"},
164 {"sinhl", "_Sinhl_e#"},
165 {"sinhw", "_Sinhw_e#"},
166 {"sqrt", "_Sqrt_e#"},
167 {"sqrtf", "_Sqrtf_e#"},
168 {"sqrtl", "_Sqrtl_e#"},
169 {"sqrtw", "_Sqrtw_e#"},
170 {"tgamma", "_Tgamma_e#"},
171 {"tgammaf", "_Tgammaf_e#"},
172 {"tgammal", "_Tgammal_e#"},
173 {"tgammaw", "_Tgammaw_e#"}
174 };
175
176 static void
177 ia64_hpux_add_pragma_builtin (tree func)
178 {
179 size_t i;
180
181 if (!flag_isoc94 && flag_iso)
182 {
183 for (i = 0; i < ARRAY_SIZE (c89_mathlib_name_list); i++)
184 {
185 if (!strcmp(c89_mathlib_name_list[i].realname,
186 IDENTIFIER_POINTER (func)))
187 {
188 add_to_renaming_pragma_list(func,
189 get_identifier(c89_mathlib_name_list[i].c89name));
190 }
191 }
192 }
193 }