Patch for missing sinf, cosf, ... [was: wchar_t working on sparc-sun-solaris2.6]

Branko Branko
Mon Jun 5 04:09:00 GMT 2000


O.K., here's the first patch. It fixes problems with missing c9x math
functions on sparc-sun-solaris2.6.

Although the builtin functions exist, it seems that GCC sometimes
can't expand them inline and generates a call to the library function
instead. Thus, libstdc++ on Solaris contains references to sinf, cosf
and sqrtf. This patch provides implementations of these functions
(and fabsf which is also built-in, although it's not causing a problem
for now). This solution is generic and should work on other systems
that don't provide these functions.


2000-06-05  Branko Cibej  <branko.cibej@hermes.si>

	* acinclude.m4 (GLIBCPP_CHECK_BUILTIN_MATH_SUPP): Check for sinf,
	cosf, fabsf and sqrtf.

	* math/Makefile.am (EXTRA_DIST): Add sinf.c, cosf.c, fabsf.c, sqrtf.c.
	* math/sinf.c, math/cosf.c, math/fabsf.c, math/sqrtf.c:  New files.


    Brane

-- 
Branko Čibej                 <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 1) 586 53 49     fax: (+386 1) 586 52 70
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/acinclude.m4,v
retrieving revision 1.24
diff -c -p -r1.24 acinclude.m4
*** acinclude.m4	2000/06/02 07:24:14	1.24
--- acinclude.m4	2000/06/05 10:53:35
*************** AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPP
*** 242,247 ****
--- 242,248 ----
    AC_MSG_RESULT($use_builtin_sinf)
    if test $use_builtin_sinf = "yes"; then
      AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
+     AC_REPLACE_MATHFUNCS(sinf)
    fi
  
    AC_MSG_CHECKING([for __builtin_cosf])
*************** AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPP
*** 251,256 ****
--- 252,258 ----
    AC_MSG_RESULT($use_builtin_cosf)
    if test $use_builtin_cosf = "yes"; then
      AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
+     AC_REPLACE_MATHFUNCS(cosf)
    fi
  
    AC_MSG_CHECKING([for __builtin_fabsf])
*************** AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPP
*** 260,265 ****
--- 262,268 ----
    AC_MSG_RESULT($use_builtin_fabsf)
    if test $use_builtin_fabsf = "yes"; then
      AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
+     AC_REPLACE_MATHFUNCS(fabsf)
    fi
  
    AC_MSG_CHECKING([for __builtin_sqrtf])
*************** AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPP
*** 269,274 ****
--- 272,278 ----
    AC_MSG_RESULT($use_builtin_sqrtf)
    if test $use_builtin_sqrtf = "yes"; then
      AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
+     AC_REPLACE_MATHFUNCS(sqrtf)
    fi
  ])
  
Index: math/Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/math/Makefile.am,v
retrieving revision 1.2
diff -c -p -r1.2 Makefile.am
*** Makefile.am	2000/04/28 02:50:55	1.2
--- Makefile.am	2000/06/05 10:53:35
*************** EXTRA_LONG_DOUBLE_yes = \
*** 31,36 ****
--- 31,37 ----
  	signbitl.c cabsl.c 
  
  EXTRA_DIST = \
+ 	sinf.c cosf.c fabsf.c sqrtf.c \
  	ccos.c ccosf.c ccosh.c ccoshf.c ccoshl.c \
  	cexp.c cexpf.c c_log.c c_logf.c  clog10.c clog10f.c \
  	cpow.c cpowf.c csin.c csinf.c csinh.c csinhf.c \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mathfuncs.tar
Type: application/x-tar
Size: 20480 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20000605/b6bf1eee/attachment.tar>


More information about the Libstdc++ mailing list