Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm
Commit Message
On 10/3/17, H.J. Lu <hjl.tools@gmail.com> wrote:
> On 10/3/17, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On 10/3/17, Gabriel F. T. Gomes <gabriel@inconstante.eti.br> wrote:
>>> On 03 Oct 2017, Joseph Myers wrote:
>>>
>>>>> +/* In C++ mode, __MATH_TG cannot be used, because it relies on
>>>>> + __builtin_types_compatible_p, which is a C-only builtin. On the
>>>>> + other hand, overloading provides the means to distinguish between
>>>>> + the floating-point types. The overloading resolution will match
>>>>> + the correct parameter (regardless of type qualifiers (i.e.: const
>>>>> + and volatile). */
>>>>
>>>>(twice in this patch, and once already in math.h) is missing a second
>>>>close parenthesis to match the first open parenthesis, and should be
>>>>fixed.
>>>
>>> Thanks. Pushed with these changes.
>>>
>>>
>>
>> On i686 wit GCC 7, I got
>>
>> test-math-iscanonical.cc: In function ‘void check_type()’:
>> test-math-iscanonical.cc:33:11: error: use of an operand of type
>> ‘bool’ in ‘operator++’ is deprecated [-Werror=deprecated]
>> errors++;
>> ^~
>> test-math-iscanonical.cc: In instantiation of ‘void check_type() [with
>> T = float]’:
>> test-math-iscanonical.cc:39:22: required from here
>> test-math-iscanonical.cc:33:11: error: use of an operand of type
>> ‘bool’ in ‘operator++’ is deprecated [-Werror=deprecated]
>> errors++;
>> ~~~~~~^~
>>
>
> I am testing this:
>
> diff --git a/math/test-math-iscanonical.cc b/math/test-math-iscanonical.cc
> index aba68acb4f..8ced7a73b4 100644
> --- a/math/test-math-iscanonical.cc
> +++ b/math/test-math-iscanonical.cc
> @@ -20,7 +20,7 @@
> #include <math.h>
> #include <stdio.h>
>
> -static bool errors;
> +static int errors;
>
> template <class T>
> static void
>
>
This is what I checked in.
Comments
On 03 Oct 2017, H.J. Lu wrote:
>On 10/3/17, H.J. Lu <hjl.tools@gmail.com> wrote:
>> --- a/math/test-math-iscanonical.cc
>> +++ b/math/test-math-iscanonical.cc
>> @@ -20,7 +20,7 @@
>> #include <math.h>
>> #include <stdio.h>
>>
>> -static bool errors;
>> +static int errors;
>>
>> template <class T>
>> static void
>>
>>
>
>This is what I checked in.
Thanks!
On Wed, 4 Oct 2017, H.J. Lu wrote:
> This is what I checked in.
This fix doesn't seem to be on 2.26 branch, but needs to go there as the
original patch went there.
I don't think using an int count of errors and returning it from do_test
is a good coding pattern, because if the count reaches 77 it will result
in a spurious UNSUPPORTED result. Of course in this particular test it
can't reach 77, but a better pattern is either a boolean error state (set
to true rather than using ++, given the warning quoted here), or a count
but with do_test returning errors != 0.
On 10/04/2017 03:15 PM, Joseph Myers wrote:
> On Wed, 4 Oct 2017, H.J. Lu wrote:
>
>> This is what I checked in.
>
> This fix doesn't seem to be on 2.26 branch, but needs to go there as the
> original patch went there.
>
> I don't think using an int count of errors and returning it from do_test
> is a good coding pattern, because if the count reaches 77 it will result
> in a spurious UNSUPPORTED result. Of course in this particular test it
> can't reach 77, but a better pattern is either a boolean error state (set
> to true rather than using ++, given the warning quoted here), or a count
> but with do_test returning errors != 0.
Agreed. Note that TEST_VERIFY allows the test to continue after a
failure, and it also arranges for a non-zero exit status (even across
fork, but currently not across dlopen). It's usually a good alternative
to such error variables.
Thanks,
Florian
From 117353f294b215a164905ab6d412f3bf8d77ae5a Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 3 Oct 2017 17:11:55 -0700
Subject: [PATCH] test-math-iscanonical.cc: Replace bool with int
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix GCC 7 compilation error:
test-math-iscanonical.cc: In function ‘void check_type()’:
test-math-iscanonical.cc:33:11: error: use of an operand of type ‘bool’ in ‘operator++’ is deprecated [-Werror=deprecated]
errors++;
^~
* math/test-math-iscanonical.cc (error): Replace bool with int.
---
math/test-math-iscanonical.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -20,7 +20,7 @@
#include <math.h>
#include <stdio.h>
-static bool errors;
+static int errors;
template <class T>
static void
--
2.13.6