<p dir="ltr">Could we use __LIBCPP_PREFERRED_OVERLOAD to get this working even with older glibc (and recent clang)?</p>
<div class="gmail_extra"><br><div class="gmail_quote">On 27 May 2016 3:26 p.m., "Eric Fiselier via cfe-commits" <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Fri May 27 17:19:53 2016<br>
New Revision: 271060<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=271060&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=271060&view=rev</a><br>
Log:<br>
Tolerate incorrect return type for 'isinf' and 'isnan' in tests.<br>
<br>
Summary:<br>
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.<br>
<br>
Since there is no longer a way to 'XFAIL' the tests I choose to simply tolerate this bug.<br>
<br>
See <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=19439" rel="noreferrer" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=19439</a><br>
<br>
<br>
Reviewers: rsmith, mclow.lists, EricWF<br>
<br>
Subscribers: jroelofs, cfe-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D19835" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19835</a><br>
<br>
Removed:<br>
libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp<br>
libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp<br>
libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp<br>
libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp<br>
Modified:<br>
libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp<br>
libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp<br>
<br>
Modified: libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp?rev=271060&r1=271059&r2=271060&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp?rev=271060&r1=271059&r2=271060&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/depr/depr.c.headers/math_h.pass.cpp Fri May 27 17:19:53 2016<br>
@@ -9,9 +9,6 @@<br>
<br>
// <math.h><br>
<br>
-// NOTE: isinf and isnan are tested separately because they are expected to fail<br>
-// on linux. We don't want their expected failure to hide other failures in this file.<br>
-<br>
#include <math.h><br>
#include <type_traits><br>
#include <cassert><br>
@@ -631,6 +628,29 @@ void test_isgreaterequal()<br>
assert(isgreaterequal(-1.0, 0.F) == false);<br>
}<br>
<br>
+void test_isinf()<br>
+{<br>
+#ifdef isinf<br>
+#error isinf defined<br>
+#endif<br>
+ static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");<br>
+<br>
+ typedef decltype(isinf((double)0)) DoubleRetType;<br>
+#ifndef __linux__<br>
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");<br>
+#else<br>
+ // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in<br>
+ // all C++ dialects. The test should tolerate this.<br>
+ // See: <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=19439" rel="noreferrer" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=19439</a><br>
+ static_assert((std::is_same<DoubleRetType, bool>::value<br>
+ || std::is_same<DoubleRetType, int>::value), "");<br>
+#endif<br>
+<br>
+ static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");<br>
+ static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");<br>
+ assert(isinf(-1.0) == false);<br>
+}<br>
+<br>
void test_isless()<br>
{<br>
#ifdef isless<br>
@@ -688,6 +708,29 @@ void test_islessgreater()<br>
assert(islessgreater(-1.0, 0.F) == true);<br>
}<br>
<br>
+void test_isnan()<br>
+{<br>
+#ifdef isnan<br>
+#error isnan defined<br>
+#endif<br>
+ static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");<br>
+<br>
+ typedef decltype(isnan((double)0)) DoubleRetType;<br>
+#ifndef __linux__<br>
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");<br>
+#else<br>
+ // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in<br>
+ // all C++ dialects. The test should tolerate this.<br>
+ // See: <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=19439" rel="noreferrer" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=19439</a><br>
+ static_assert((std::is_same<DoubleRetType, bool>::value<br>
+ || std::is_same<DoubleRetType, int>::value), "");<br>
+#endif<br>
+<br>
+ static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");<br>
+ static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");<br>
+ assert(isnan(-1.0) == false);<br>
+}<br>
+<br>
void test_isunordered()<br>
{<br>
#ifdef isunordered<br>
@@ -1443,9 +1486,11 @@ int main()<br>
test_isnormal();<br>
test_isgreater();<br>
test_isgreaterequal();<br>
+ test_isinf();<br>
test_isless();<br>
test_islessequal();<br>
test_islessgreater();<br>
+ test_isnan();<br>
test_isunordered();<br>
test_acosh();<br>
test_asinh();<br>
<br>
Removed: libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp?rev=271059&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp?rev=271059&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp (removed)<br>
@@ -1,30 +0,0 @@<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is dual licensed under the MIT and the University of Illinois Open<br>
-// Source Licenses. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-// <math.h><br>
-<br>
-// isinf<br>
-<br>
-// XFAIL: linux<br>
-<br>
-#include <math.h><br>
-#include <type_traits><br>
-#include <cassert><br>
-<br>
-int main()<br>
-{<br>
-#ifdef isinf<br>
-#error isinf defined<br>
-#endif<br>
- static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");<br>
- assert(isinf(-1.0) == false);<br>
-}<br>
<br>
Removed: libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp?rev=271059&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp?rev=271059&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp (removed)<br>
@@ -1,30 +0,0 @@<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is dual licensed under the MIT and the University of Illinois Open<br>
-// Source Licenses. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-// <math.h><br>
-<br>
-// isnan<br>
-<br>
-// XFAIL: linux<br>
-<br>
-#include <math.h><br>
-#include <type_traits><br>
-#include <cassert><br>
-<br>
-int main()<br>
-{<br>
-#ifdef isnan<br>
-#error isnan defined<br>
-#endif<br>
- static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");<br>
- assert(isnan(-1.0) == false);<br>
-}<br>
<br>
Modified: libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp?rev=271060&r1=271059&r2=271060&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp?rev=271060&r1=271059&r2=271060&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/numerics/c.math/cmath.pass.cpp Fri May 27 17:19:53 2016<br>
@@ -9,9 +9,6 @@<br>
<br>
// <cmath><br>
<br>
-// NOTE: isinf and isnan are tested separately because they are expected to fail<br>
-// on linux. We don't want their expected failure to hide other failures in this file.<br>
-<br>
#include <cmath><br>
#include <type_traits><br>
#include <cassert><br>
@@ -632,6 +629,29 @@ void test_isgreaterequal()<br>
assert(std::isgreaterequal(-1.0, 0.F) == false);<br>
}<br>
<br>
+void test_isinf()<br>
+{<br>
+#ifdef isinf<br>
+#error isinf defined<br>
+#endif<br>
+ static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");<br>
+<br>
+ typedef decltype(std::isinf((double)0)) DoubleRetType;<br>
+#ifndef __linux__<br>
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");<br>
+#else<br>
+ // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in<br>
+ // all C++ dialects. The test should tolerate this.<br>
+ // See: <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=19439" rel="noreferrer" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=19439</a><br>
+ static_assert((std::is_same<DoubleRetType, bool>::value<br>
+ || std::is_same<DoubleRetType, int>::value), "");<br>
+#endif<br>
+<br>
+ static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");<br>
+ static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");<br>
+ assert(std::isinf(-1.0) == false);<br>
+}<br>
+<br>
void test_isless()<br>
{<br>
#ifdef isless<br>
@@ -689,6 +709,29 @@ void test_islessgreater()<br>
assert(std::islessgreater(-1.0, 0.F) == true);<br>
}<br>
<br>
+void test_isnan()<br>
+{<br>
+#ifdef isnan<br>
+#error isnan defined<br>
+#endif<br>
+ static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");<br>
+<br>
+ typedef decltype(std::isnan((double)0)) DoubleRetType;<br>
+#ifndef __linux__<br>
+ static_assert((std::is_same<DoubleRetType, bool>::value), "");<br>
+#else<br>
+ // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in<br>
+ // all C++ dialects. The test should tolerate this.<br>
+ // See: <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=19439" rel="noreferrer" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=19439</a><br>
+ static_assert((std::is_same<DoubleRetType, bool>::value<br>
+ || std::is_same<DoubleRetType, int>::value), "");<br>
+#endif<br>
+<br>
+ static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");<br>
+ static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");<br>
+ assert(std::isnan(-1.0) == false);<br>
+}<br>
+<br>
void test_isunordered()<br>
{<br>
#ifdef isunordered<br>
@@ -1466,9 +1509,11 @@ int main()<br>
test_isnormal();<br>
test_isgreater();<br>
test_isgreaterequal();<br>
+ test_isinf();<br>
test_isless();<br>
test_islessequal();<br>
test_islessgreater();<br>
+ test_isnan();<br>
test_isunordered();<br>
test_acosh();<br>
test_asinh();<br>
<br>
Removed: libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp?rev=271059&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp?rev=271059&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/numerics/c.math/cmath_isinf.pass.cpp (removed)<br>
@@ -1,30 +0,0 @@<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is dual licensed under the MIT and the University of Illinois Open<br>
-// Source Licenses. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-// <cmath><br>
-<br>
-// isinf<br>
-<br>
-// XFAIL: linux<br>
-<br>
-#include <cmath><br>
-#include <type_traits><br>
-#include <cassert><br>
-<br>
-int main()<br>
-{<br>
-#ifdef isinf<br>
-#error isinf defined<br>
-#endif<br>
- static_assert((std::is_same<decltype(std::isinf((float)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(std::isinf((double)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(std::isinf(0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(std::isinf((long double)0)), bool>::value), "");<br>
- assert(std::isinf(-1.0) == false);<br>
-}<br>
\ No newline at end of file<br>
<br>
Removed: libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp?rev=271059&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp?rev=271059&view=auto</a><br>
==============================================================================<br>
--- libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp (original)<br>
+++ libcxx/trunk/test/std/numerics/c.math/cmath_isnan.pass.cpp (removed)<br>
@@ -1,30 +0,0 @@<br>
-//===----------------------------------------------------------------------===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is dual licensed under the MIT and the University of Illinois Open<br>
-// Source Licenses. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-// <cmath><br>
-<br>
-// isnan<br>
-<br>
-// XFAIL: linux<br>
-<br>
-#include <cmath><br>
-#include <type_traits><br>
-#include <cassert><br>
-<br>
-int main()<br>
-{<br>
-#ifdef isnan<br>
-#error isnan defined<br>
-#endif<br>
- static_assert((std::is_same<decltype(std::isnan((float)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(std::isnan((double)0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(std::isnan(0)), bool>::value), "");<br>
- static_assert((std::is_same<decltype(std::isnan((long double)0)), bool>::value), "");<br>
- assert(std::isnan(-1.0) == false);<br>
-}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>