This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Preserve ::is{inf,nan}{f,l} prototypes even for C++11 and later
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Date: Wed, 3 Feb 2016 18:28:52 +0100
- Subject: Re: [PATCH] Preserve ::is{inf,nan}{f,l} prototypes even for C++11 and later
- Authentication-results: sourceware.org; auth=none
- References: <20160201162152 dot GH3017 at tucnak dot redhat dot com> <20160201163400 dot GH3471 at redhat dot com> <56B23119 dot 3050605 at linaro dot org> <20160203171536 dot GQ3471 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Feb 03, 2016 at 05:15:36PM +0000, Jonathan Wakely wrote:
> >Using isinf{f,l} by including just <cmath> along with C++11? If it is the
> >case please open a bugzilla (or update the original) and please commit
> >the fix.
>
> Yes, including either <cmath> or <math.h> in C++11 code and trying to
> use isinf{f,l}.
>
> >Also, do we have a testcase on libstdc++ to catch this?
>
> No, because nothing in libstdc++ uses or cares about isinf{f,l}, they
> are not standard C++ functions. Just like we don't have tests for
> other glibc functions such as getwd(3) that aren't part of ISO C++.
>
> We could add a test, but it seems like it's the wrong place for it. It
> would have to be limited to only run on *-*-*gnu* targets, since those
> functions might not be available elsewhere. However, if glibc doesn't
> have any tests that use a C++ compiler maybe libstdc++ is the easiest
> place for it.
I believe glibc testsuite has some C++ tests, though not many.
You could just test with C++ that you can link (or run, whatever)
#define _GNU_SOURCE 1
#include <math.h>
#include <stdlib.h>
int
main ()
{
if (isinff (1.0f)
|| !isinff (INFINITY)
|| isinfl (1.0L)
|| !isinfl (INFINITY)
|| isnanf (2.0f)
|| !isnanf (NAN)
|| isnanl (2.0L)
|| !isnanl (NAN))
abort ();
}
or so.
Jakub