This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Gerald Pfeifer <gerald at pfeifer dot com>
- Cc: John David Anglin <dave dot anglin at bell dot net>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org, Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Thu, 4 Feb 2016 22:49:42 +0000
- Subject: Re: [PATCH] Fix libstdc++-v3/include/math.h:66:1 2: error: 'constexpr bool std::isnan(double)' conflicts with a previous declaration
- Authentication-results: sourceware.org; auth=none
- References: <83B5E03D-B776-49BE-B1C2-23E19D8E9410 at bell dot net> <20160128104655 dot GY15084 at redhat dot com> <alpine dot LSU dot 2 dot 20 dot 1602042306080 dot 3697 at anthias>
On 04/02/16 23:11 +0100, Gerald Pfeifer wrote:
It seems to break older versions of FreeBSD that have GCC 4.2
as their system compiler. (Those versions aren't actually all
that old, they are stuck with GCC 4.2 as the last version under
GPLv2.)
The version of GCC doesn't matter, it's whether libc declares those
functions or not.
I tested the change on modern versions of FreeBSD and DragonFly which
have the following so don't declare them:
/*
* Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
* isinf() as functions taking double. C99, and the subsequent POSIX revisions
* (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
* point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
* expose the newer definition, assuming that the language spec takes
* precedence over the operating system interface spec.
*/
#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
#undef isinf
#undef isnan
int isinf(double);
int isnan(double);
#endif
I'll enable the configure test for all targets and check that it's OK
on these ones which definitely don't declare the obsolete functions.
It should also fix it on systems that do declare them.