From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58660 invoked by alias); 20 Apr 2017 10:03:41 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 58582 invoked by uid 89); 20 Apr 2017 10:03:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Apr 2017 10:03:39 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B37288AE65; Thu, 20 Apr 2017 10:03:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B37288AE65 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B37288AE65 Received: from localhost (unknown [10.33.36.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C85980B0F; Thu, 20 Apr 2017 10:03:39 +0000 (UTC) Date: Thu, 20 Apr 2017 10:03:00 -0000 From: Jonathan Wakely To: Florian Weimer Cc: Jakub Jelinek , gcc@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: Deprecating arithmetic on std::atomic Message-ID: <20170420100338.GI3412@redhat.com> References: <20170419170736.GY3412@redhat.com> <170e0b73-e561-82a9-7f26-e7b5d40a0f1c@redhat.com> <20170420091809.GA3412@redhat.com> <20170420092148.GO1809@tucnak> <20170420092540.GC3412@redhat.com> <20170420095205.GG3412@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-04/txt/msg00081.txt.bz2 On 20/04/17 11:57 +0200, Florian Weimer wrote: >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 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. >> >>>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. Ah yes, you're right. Yet another case where warning suppression in system headers hurts the library's ability to give diagnostics. We can't warn about using incomplete types in std::unique_ptr because the -Wdelete-incomplete warning gets suppressed, and the interaction of #pragma GCC diagnostic with -Wsystem-headers is ... interesting. We need a way to enable warnings for specific blocks of code, to say "do not suppress warnings here, even though it's in a system header".