From: Florian Weimer <fweimer@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>, gcc@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: Deprecating arithmetic on std::atomic<void*>
Date: Thu, 20 Apr 2017 09:57:00 -0000 [thread overview]
Message-ID: <cec3f0f5-7739-21ad-d2e7-5436891dfcce@redhat.com> (raw)
In-Reply-To: <20170420095205.GG3412@redhat.com>
On 04/20/2017 11:52 AM, Jonathan Wakely wrote:
> On 20/04/17 11:43 +0200, Florian Weimer wrote:
>> On 04/20/2017 11:25 AM, Jonathan Wakely wrote:
>>
>>>> I mean, with -pedantic-errors we already error on void * arighmetics
>>>> or function pointer arithmetics. If std::atomic<void*> would use
>>>> the void * arithmetics, it would also reject it. Or does it use
>>>> integer
>>>> arithmetics instead?
>>>
>>> No, it does it on void*, but the __atomic built-ins still perform that
>>> arithmetic even with -pedantic-errors.
>>
>> sizeof is not defined for the relevant types, either, and already
>> triggers a warning by default:
>>
>> t.cc:25:58: warning: invalid application of âsizeofâ to a void type
>> [-Wpointer-arith]
>> _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); }
>
> That could be easily avoided if we care about supporting arithmetic on
> std::atomic<void*>.
>
>> I think the actual problem here is the suppression of warnings from
>> system headers.
>
> The atomic built-ins still don't warn even with -Wsystem-headers
Sorry, this is what I meant: -pedantic-errors does not catch this case
due to the system header warning suppression. Otherwise, with the
current std::atomic implementation, -pedantic-errors would already
disable the extension on std::atomic alongside with the extension on
built-in pointer types, due to the use of sizeof in the definition of
_M_type_size.
Thanks,
Florian
next prev parent reply other threads:[~2017-04-20 9:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 17:07 Jonathan Wakely
2017-04-19 17:43 ` Ville Voutilainen
2017-04-20 6:19 ` Florian Weimer
2017-04-20 9:18 ` Jonathan Wakely
2017-04-20 9:21 ` Jakub Jelinek
2017-04-20 9:25 ` Jonathan Wakely
2017-04-20 9:30 ` Jonathan Wakely
2017-04-20 9:30 ` Jakub Jelinek
2017-04-20 9:43 ` Florian Weimer
2017-04-20 9:52 ` Jonathan Wakely
2017-04-20 9:57 ` Florian Weimer [this message]
2017-04-20 10:03 ` Jonathan Wakely
2017-04-20 10:07 ` Jakub Jelinek
2017-04-20 10:12 ` Jonathan Wakely
2017-04-20 11:20 ` Jonathan Wakely
2017-04-20 12:20 ` Jonathan Wakely
2017-04-20 9:22 ` Jonathan Wakely
2017-04-20 9:25 ` Florian Weimer
2017-04-20 9:31 ` Jonathan Wakely
2017-04-20 9:39 ` Jonathan Wakely
2017-04-20 9:49 ` Florian Weimer
2017-04-20 9:53 ` Jonathan Wakely
2017-04-20 11:29 ` Pedro Alves
2017-04-20 9:31 ` Marc Glisse
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=cec3f0f5-7739-21ad-d2e7-5436891dfcce@redhat.com \
--to=fweimer@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jwakely@redhat.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).