public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	"libstdc++" <libstdc++@gcc.gnu.org>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Suppress pedantic warnings about __int128
Date: Fri, 16 Jul 2021 12:29:35 +0100	[thread overview]
Message-ID: <CACb0b4kHMsQErVAzg4g=m8m100Hz4A_PJ6ufcP4x=ZG37+t+2Q@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdRXkcCm7EBVKuLCnp5xgpniyNiGH=Vnd4mROKBz_o19LA@mail.gmail.com>

On Fri, 16 Jul 2021 at 09:40, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
>
> On Fri, 16 Jul 2021, 09:38 Jonathan Wakely, <jwakely.gcc@gmail.com> wrote:
>>
>>
>>
>> On Fri, 16 Jul 2021, 09:30 Jakub Jelinek via Libstdc++, <libstdc++@gcc.gnu.org> wrote:
>>>
>>> On Fri, Jul 16, 2021 at 10:27:09AM +0200, Jakub Jelinek via Gcc-patches wrote:
>>> > On Fri, Jul 16, 2021 at 08:41:06AM +0100, Jonathan Wakely via Gcc-patches wrote:
>>> > > --- a/libstdc++-v3/include/bits/max_size_type.h
>>> > > +++ b/libstdc++-v3/include/bits/max_size_type.h
>>> > > @@ -417,7 +417,10 @@ namespace ranges
>>> > >  #endif
>>> > >
>>> > >  #if __SIZEOF_INT128__
>>> > > +#pragma GCC diagnostic push
>>> > > +#pragma GCC diagnostic ignored "-Wpedantic"
>>> > >        using __rep = unsigned __int128;
>>> > > +#pragma GCC diagnostic pop
>>> >
>>> > At least in simple cases like this, wouldn't
>>> >       using __rep = __extension__ unsigned __int128;
>>>
>>> __extension__ using __rep = unsigned __int128;
>>> actually (now tested).
>>
>>
>> Ah, thanks. I didn't find the right syntax, and I know __extension__ doesn't work in other cases, like quad float literals, so I assumed it doesn't work here. I suppose the literals don't work because the warning comes from the processor, which doesn't understand __extension__ (and also ignores the diagnostic pragma).
>
>
> That grammar for a using-declaration makes no sense at all btw ;-)

Hmm, in fact it seems that we can just use the __uint128_t typedef
instead, which doesn't give a pedwarn:

  using __rep = __uint128_t;

Is that typedef always available if __int128 is? There's a comment in
gcc/c-family/c-common.c that I don't understand:

#if HOST_BITS_PER_WIDE_INT >= 64
  /* Note that this is different than the __int128 type that's part of
     the generic __intN support.  */
  if (targetm.scalar_mode_supported_p (TImode))
    lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
                       TYPE_DECL,
                       get_identifier ("__int128_t"),
                       intTI_type_node));
#endif

They are the same type in C++, so what is "different"? Is it possible
for __int128 to be different from a TImode integer?

We can still use __extension__ elsewhere, for defining explicit
specializations using the non-standard integers, e.g.

#define __INT_N(TYPE)                  \
+  __extension__                                \
  template<>                           \
    struct __is_integer<TYPE>          \
    {                                  \
      enum { __value = 1 };            \
      typedef __true_type __type;      \
    };


  reply	other threads:[~2021-07-16 11:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  7:41 Jonathan Wakely
2021-07-16  8:27 ` Jakub Jelinek
2021-07-16  8:29   ` Jakub Jelinek
2021-07-16  8:38     ` Jonathan Wakely
2021-07-16  8:39       ` Jonathan Wakely
2021-07-16 11:29         ` Jonathan Wakely [this message]
2021-07-16 13:02           ` [PATCH] libstdc++: Use __extension__ instead of diagnostic pragmas (was: Suppress pedantic warnings about __int128) Jonathan Wakely
2021-07-16 14:39             ` Jonathan Wakely

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='CACb0b4kHMsQErVAzg4g=m8m100Hz4A_PJ6ufcP4x=ZG37+t+2Q@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jwakely.gcc@gmail.com \
    --cc=libstdc++@gcc.gnu.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).