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