This is the mail archive of the libstdc++-prs@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]

libstdc++/61: Conflicting types for nan() during installation



>Number:         61
>Category:       libstdc++
>Synopsis:       Conflicting types for nan() during installation
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 18 08:37:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Deron Meranda
>Release:        2.90.8
>Organization:
>Environment:
HP-UX 11.0, gcc 2.95.2
>Description:
Trying to build/install libstdc++ fails under HP-UX 11.0.
During the compile of the file libstdc++/math/signbit.c,
the following error is output:

In file included from /opt2/src/gcc-2.95.2/libstdc++/math/mathconf.h:230,
                 from /opt2/src/gcc-2.95.2/libstdc++/math/signbit.c:32:
/opt2/src/gcc-2.95.2/libstdc++/math/complex-stub.h:85: conflicting types for `nan'
/opt2/src/gcc-build2/gcc/include/math.h:231: previous declaration of `nan'

The HP-UX 11.0 operating system declares the following
prototype for function nan() in /usr/include/math.h,

   extern double nan(const char*)

whereas libstdc++ 2.90.8 declares it as

   double nan(void)
>How-To-Repeat:
Install gcc 2.95.2 with libstdc++ 2.90.8 placed in the
libstdc++ subdirectory.  Using the HP-UX bundled cc
compiler.  Configured with options,

configure --prefix=/opt/gnu/gcc --with-gnu-as
--with-as=/opt/gnu/bin/gas --enable-haifa
--enable-threads=posix --enable-namespaces
--enable-languages=c,c++,java
hppa1.0-hp-hpux11.00
>Fix:
Changing the following files seems to appease the
compiler, but I'm not sure what the real solution
should be or what matches the language standard...

libstdc++-2.90.8/math/complex-stub.h
libstdc++-2.90.8/math/mathconf.h
libstdc++-2.90.8/math/nan.c

I modified the nan() function to take a const char*
argument to make it match the HP-UX declaration.
The macro NAN was defined to be (nan("")).  And the
nan() function was rewritten as,

double
nan (const char *n)
{
   if (n==NULL || ! n[0])
      return strtod ("nan", NULL);
   else
      return strtod (n, NULL);
}
>Release-Note:
>Audit-Trail:
>Unformatted:

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