]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: testsuite: Guard use of C99 std::log2
authorJonathan Wakely <jwakely@redhat.com>
Tue, 28 Jun 2022 08:17:06 +0000 (09:17 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 22 Jul 2022 07:07:03 +0000 (08:07 +0100)
This prevents the test from failing if the only thing not supported is
the text printed to the log about the size of the floating-point type.

libstdc++-v3/ChangeLog:

* testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math
functions are available.

(cherry picked from commit 30aea28bd30027e0a6be8e3077828256779954b3)

libstdc++-v3/testsuite/20_util/from_chars/4.cc

index 7cee4dcbc2320a6e0aee95d9240df80109812c9b..4064f1d4177556a68edb61ccd7e6713bf2dbd354 100644 (file)
@@ -300,9 +300,11 @@ test_max_mantissa()
 
   if (Float_limits::is_iec559 && Float_limits::digits < UInt_limits::digits)
   {
+#ifdef _GLIBCXX_USE_C99_MATH_TR1
     std::printf("Testing %d-bit float, using %zu-bit integer\n",
        Float_limits::digits + (int)std::log2(Float_limits::max_exponent) + 1,
        sizeof(UIntT) * __CHAR_BIT__);
+#endif
 
     std::from_chars_result res;
     FloatT flt;
This page took 0.058128 seconds and 5 git commands to generate.