Tolerate incorrect return type for 'isinf' and 'isnan' in tests.
Summary: GLIBC recently removed the incorrect `int isinf(double)` and `int isnan(double)` overloads in C++11 and greater. This causes previously `XFAIL: linux` tests to start passing. Since there is no longer a way to 'XFAIL' the tests I choose to simply tolerate this bug. See https://sourceware.org/bugzilla/show_bug.cgi?id=19439 Reviewers: rsmith, mclow.lists, EricWF Subscribers: jroelofs, cfe-commits Differential Revision: http://reviews.llvm.org/D19835 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271060 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -9,9 +9,6 @@
|
|||||||
|
|
||||||
// <math.h>
|
// <math.h>
|
||||||
|
|
||||||
// NOTE: isinf and isnan are tested separately because they are expected to fail
|
|
||||||
// on linux. We don't want their expected failure to hide other failures in this file.
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -631,6 +628,29 @@ void test_isgreaterequal()
|
|||||||
assert(isgreaterequal(-1.0, 0.F) == false);
|
assert(isgreaterequal(-1.0, 0.F) == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_isinf()
|
||||||
|
{
|
||||||
|
#ifdef isinf
|
||||||
|
#error isinf defined
|
||||||
|
#endif
|
||||||
|
static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
|
||||||
|
|
||||||
|
typedef decltype(isinf((double)0)) DoubleRetType;
|
||||||
|
#ifndef __linux__
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value), "");
|
||||||
|
#else
|
||||||
|
// GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
|
||||||
|
// all C++ dialects. The test should tolerate this.
|
||||||
|
// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value
|
||||||
|
|| std::is_same<DoubleRetType, int>::value), "");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");
|
||||||
|
static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
|
||||||
|
assert(isinf(-1.0) == false);
|
||||||
|
}
|
||||||
|
|
||||||
void test_isless()
|
void test_isless()
|
||||||
{
|
{
|
||||||
#ifdef isless
|
#ifdef isless
|
||||||
@@ -688,6 +708,29 @@ void test_islessgreater()
|
|||||||
assert(islessgreater(-1.0, 0.F) == true);
|
assert(islessgreater(-1.0, 0.F) == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_isnan()
|
||||||
|
{
|
||||||
|
#ifdef isnan
|
||||||
|
#error isnan defined
|
||||||
|
#endif
|
||||||
|
static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
|
||||||
|
|
||||||
|
typedef decltype(isnan((double)0)) DoubleRetType;
|
||||||
|
#ifndef __linux__
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value), "");
|
||||||
|
#else
|
||||||
|
// GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
|
||||||
|
// all C++ dialects. The test should tolerate this.
|
||||||
|
// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value
|
||||||
|
|| std::is_same<DoubleRetType, int>::value), "");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");
|
||||||
|
static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
|
||||||
|
assert(isnan(-1.0) == false);
|
||||||
|
}
|
||||||
|
|
||||||
void test_isunordered()
|
void test_isunordered()
|
||||||
{
|
{
|
||||||
#ifdef isunordered
|
#ifdef isunordered
|
||||||
@@ -1443,9 +1486,11 @@ int main()
|
|||||||
test_isnormal();
|
test_isnormal();
|
||||||
test_isgreater();
|
test_isgreater();
|
||||||
test_isgreaterequal();
|
test_isgreaterequal();
|
||||||
|
test_isinf();
|
||||||
test_isless();
|
test_isless();
|
||||||
test_islessequal();
|
test_islessequal();
|
||||||
test_islessgreater();
|
test_islessgreater();
|
||||||
|
test_isnan();
|
||||||
test_isunordered();
|
test_isunordered();
|
||||||
test_acosh();
|
test_acosh();
|
||||||
test_asinh();
|
test_asinh();
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <math.h>
|
|
||||||
|
|
||||||
// isinf
|
|
||||||
|
|
||||||
// XFAIL: linux
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
#ifdef isinf
|
|
||||||
#error isinf defined
|
|
||||||
#endif
|
|
||||||
static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
|
|
||||||
assert(isinf(-1.0) == false);
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <math.h>
|
|
||||||
|
|
||||||
// isnan
|
|
||||||
|
|
||||||
// XFAIL: linux
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
#ifdef isnan
|
|
||||||
#error isnan defined
|
|
||||||
#endif
|
|
||||||
static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
|
|
||||||
assert(isnan(-1.0) == false);
|
|
||||||
}
|
|
||||||
@@ -9,9 +9,6 @@
|
|||||||
|
|
||||||
// <cmath>
|
// <cmath>
|
||||||
|
|
||||||
// NOTE: isinf and isnan are tested separately because they are expected to fail
|
|
||||||
// on linux. We don't want their expected failure to hide other failures in this file.
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -632,6 +629,29 @@ void test_isgreaterequal()
|
|||||||
assert(std::isgreaterequal(-1.0, 0.F) == false);
|
assert(std::isgreaterequal(-1.0, 0.F) == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_isinf()
|
||||||
|
{
|
||||||
|
#ifdef isinf
|
||||||
|
#error isinf defined
|
||||||
|
#endif
|
||||||
|
static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
|
||||||
|
|
||||||
|
typedef decltype(std::isinf((double)0)) DoubleRetType;
|
||||||
|
#ifndef __linux__
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value), "");
|
||||||
|
#else
|
||||||
|
// GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
|
||||||
|
// all C++ dialects. The test should tolerate this.
|
||||||
|
// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value
|
||||||
|
|| std::is_same<DoubleRetType, int>::value), "");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");
|
||||||
|
static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");
|
||||||
|
assert(std::isinf(-1.0) == false);
|
||||||
|
}
|
||||||
|
|
||||||
void test_isless()
|
void test_isless()
|
||||||
{
|
{
|
||||||
#ifdef isless
|
#ifdef isless
|
||||||
@@ -689,6 +709,29 @@ void test_islessgreater()
|
|||||||
assert(std::islessgreater(-1.0, 0.F) == true);
|
assert(std::islessgreater(-1.0, 0.F) == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_isnan()
|
||||||
|
{
|
||||||
|
#ifdef isnan
|
||||||
|
#error isnan defined
|
||||||
|
#endif
|
||||||
|
static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
|
||||||
|
|
||||||
|
typedef decltype(std::isnan((double)0)) DoubleRetType;
|
||||||
|
#ifndef __linux__
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value), "");
|
||||||
|
#else
|
||||||
|
// GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
|
||||||
|
// all C++ dialects. The test should tolerate this.
|
||||||
|
// See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
|
||||||
|
static_assert((std::is_same<DoubleRetType, bool>::value
|
||||||
|
|| std::is_same<DoubleRetType, int>::value), "");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");
|
||||||
|
static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");
|
||||||
|
assert(std::isnan(-1.0) == false);
|
||||||
|
}
|
||||||
|
|
||||||
void test_isunordered()
|
void test_isunordered()
|
||||||
{
|
{
|
||||||
#ifdef isunordered
|
#ifdef isunordered
|
||||||
@@ -1466,9 +1509,11 @@ int main()
|
|||||||
test_isnormal();
|
test_isnormal();
|
||||||
test_isgreater();
|
test_isgreater();
|
||||||
test_isgreaterequal();
|
test_isgreaterequal();
|
||||||
|
test_isinf();
|
||||||
test_isless();
|
test_isless();
|
||||||
test_islessequal();
|
test_islessequal();
|
||||||
test_islessgreater();
|
test_islessgreater();
|
||||||
|
test_isnan();
|
||||||
test_isunordered();
|
test_isunordered();
|
||||||
test_acosh();
|
test_acosh();
|
||||||
test_asinh();
|
test_asinh();
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <cmath>
|
|
||||||
|
|
||||||
// isinf
|
|
||||||
|
|
||||||
// XFAIL: linux
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
#ifdef isinf
|
|
||||||
#error isinf defined
|
|
||||||
#endif
|
|
||||||
static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(std::isinf((double)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");
|
|
||||||
assert(std::isinf(-1.0) == false);
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
||||||
// Source Licenses. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// <cmath>
|
|
||||||
|
|
||||||
// isnan
|
|
||||||
|
|
||||||
// XFAIL: linux
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
#ifdef isnan
|
|
||||||
#error isnan defined
|
|
||||||
#endif
|
|
||||||
static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(std::isnan((double)0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");
|
|
||||||
static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");
|
|
||||||
assert(std::isnan(-1.0) == false);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user