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