ia64-c.c 5.2 KB

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