This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Preserve ::is{inf,nan}{f,l} prototypes even for C++11 and later


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


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