public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Jakub Jelinek <jakub@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] Preserve ::is{inf,nan}{f,l} prototypes even for C++11 and later
Date: Wed, 03 Feb 2016 17:15:00 -0000	[thread overview]
Message-ID: <20160203171536.GQ3471@redhat.com> (raw)
In-Reply-To: <56B23119.3050605@linaro.org>

On 03/02/16 14:55 -0200, Adhemerval Zanella wrote:
>I will quote the email referenced:
>
>> C++11 code using isinf and isnan continues to compile after that
>> change, because the C++11 standard library provides its own versions
>> conforming to the C++11 requirements. However, the C++11 library
>> doesn't provide isinff, isinfl etc. and so code using those
>> (non-standard) functions will no longer compile if they are not
>> declared by glibc.
>
>This was not clear to me, what kind of build issue are you seeing now?

There is no issue in libstdc++ this time. The problem comes when C++11
programs try to use the glibc is{inf,nan}{f,l} functions.

>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.


>On 01-02-2016 14:34, Jonathan Wakely wrote:
>> On 01/02/16 17:21 +0100, Jakub Jelinek wrote:
>>> The recent changes disable not just ::is{inf,nan} prototypes that are
>>> incompatible with C++11 and later and that are defined in <cmath> or
>>> libstdc++ <math.h> wrapper, but also the ::is{inf,nan}{f,l} prototypes,
>>> that are not incompatible with C++11.  This patch adds them back.
>>
>> N.B. I also posted Jakub's patch at
>> https://sourceware.org/ml/libc-alpha/2016-02/msg00020.html with some
>> more context. The patch is the same though, so you can ignroe my
>> duplicate.
>>
>>
>>> ---
>>> math/bits/mathcalls.h | 8 ++++++--
>>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
>>> index a48345d..1b82fcd 100644
>>> --- a/math/bits/mathcalls.h
>>> +++ b/math/bits/mathcalls.h
>>> @@ -196,7 +196,9 @@ __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
>>> _Mdouble_END_NAMESPACE
>>>
>>> #ifdef __USE_MISC
>>> -# if !defined __cplusplus || __cplusplus < 201103L /* Conflicts with C++11.  */
>>> +# if (!defined __cplusplus \
>>> +      || __cplusplus < 201103L /* isinf conflicts with C++11.  */ \
>>> +      || __MATH_DECLARING_DOUBLE == 0) /* isinff or isinfl don't.  */
>>> /* Return 0 if VALUE is finite or NaN, +1 if it
>>>    is +Infinity, -1 if it is -Infinity.  */
>>> __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
>>> @@ -232,7 +234,9 @@ __END_NAMESPACE_C99
>>> __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
>>>
>>> #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
>>> -# if !defined __cplusplus || __cplusplus < 201103L /* Conflicts with C++11.  */
>>> +# if (!defined __cplusplus \
>>> +      || __cplusplus < 201103L /* isinf conflicts with C++11.  */ \
>>> +      || __MATH_DECLARING_DOUBLE == 0) /* isinff or isinfl don't.  */
>>> /* Return nonzero if VALUE is not a number.  */
>>> __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
>>> # endif
>>> --
>>> 2.4.3
>>>

  reply	other threads:[~2016-02-03 17:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 16:22 Jakub Jelinek
2016-02-01 16:34 ` Jonathan Wakely
2016-02-03 16:56   ` Adhemerval Zanella
2016-02-03 17:15     ` Jonathan Wakely [this message]
2016-02-03 17:29       ` Jakub Jelinek
2016-02-03 17:40     ` Mike Frysinger
2016-02-03 18:04       ` Adhemerval Zanella
2016-02-09 17:24         ` Jonathan Wakely
2016-02-09 17:38           ` Carlos O'Donell
2016-02-09 21:54             ` Carlos O'Donell
2016-02-10 16:30               ` Adhemerval Zanella
2016-02-15  1:20                 ` Carlos O'Donell
2016-02-23 15:32               ` Andreas Schwab
2016-02-23 15:41                 ` Jakub Jelinek
2016-02-23 17:41                 ` Carlos O'Donell
2016-02-24  8:59                   ` Andreas Schwab
2016-02-24  9:39                     ` Carlos O'Donell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160203171536.GQ3471@redhat.com \
    --to=jwakely@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=jakub@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).