This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Usage of non-standard math function in libstdc++-v3


Can anyone tell me why __atan2() is used instead of atan2() in
libstdc++-v3/math/carg.c?  I suspect it used because it is somehow
different than plain atan2() [if I had to hazard a guess, it is
different in its treatment and reporting of domain error cases ;-].

Since __atan2() is not a standard function, shouldn't this usage in
libstdc++-v3 be checked for with a configure test of some sort?  I
suppose if __atan2() is not available, we could default to plain
atan2() with any side effects that would result and/or attempt to fix
the situation as required.

Also, most of libstdc++-v3 is built with -Werror.  For some reason,
this part of the library isn't.  FYI: this masked an implicit function
declaration that only causes an immediate problem with the shared
version of the library on FreeBSD-3.4.

This is the reason that we get:

./src/.libs/libstdc++.so: undefined reference to `__atan2'
collect2: ld returned 1 exit status

on FreeBSD-3.4 without -static at link time.

Until I learn how to make a better patch, I have applied this
to my local tree:

S rittle@latour; ccvs diff -p libstdc++-v3/math/carg.c
Index: libstdc++-v3/math/carg.c
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/math/carg.c,v
retrieving revision 1.1
diff -p -r1.1 carg.c
*** carg.c      2000/04/21 20:33:32     1.1
--- carg.c      2000/05/23 01:07:45
***************
*** 33,37 ****
  double
  carg (__complex__ double x)
  {
!   return __atan2 (__imag__ x, __real__ x);
  }
--- 33,37 ----
  double
  carg (__complex__ double x)
  {
!   return atan2 (__imag__ x, __real__ x);
  }

I can now successfully link against the shared library on FreeBSD-3.4.
'make check' now passes as many shared tests as static tests.

Regards,
Loren

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]