From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61830 invoked by alias); 27 Mar 2017 22:01:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 55821 invoked by uid 89); 27 Mar 2017 22:01:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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; Mon, 27 Mar 2017 22:01:12 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 272508046B; Mon, 27 Mar 2017 22:01:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 272508046B Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jwakely@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 272508046B Received: from localhost (unknown [10.33.36.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6833460F83; Mon, 27 Mar 2017 22:01:11 +0000 (UTC) Date: Tue, 28 Mar 2017 03:25:00 -0000 From: Jonathan Wakely To: Sandra Loosemore Cc: Gerald Pfeifer , Jason Merrill , gcc-patches@gcc.gnu.org, Joseph Myers Subject: Re: [patch] Clarify interaction of -Wnarrowing with -std Message-ID: <20170327220110.GT4425@redhat.com> References: <20160219124235.GF3171@redhat.com> <56C7666F.30601@redhat.com> <56C7783D.2040504@codesourcery.com> <20160223183853.GK3171@redhat.com> <58D82561.4030204@codesourcery.com> <20170327090925.GN4425@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="d6d1KVhp94hk3Jrm" Content-Disposition: inline In-Reply-To: <20170327090925.GN4425@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-03/txt/msg01421.txt.bz2 --d6d1KVhp94hk3Jrm Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 1190 On 27/03/17 10:09 +0100, Jonathan Wakely wrote: >On 26/03/17 14:32 -0600, Sandra Loosemore wrote: >>On 03/26/2017 02:13 PM, Gerald Pfeifer wrote: >>>Hi Jonathan, >>> >>>On Tue, 23 Feb 2016, Jonathan Wakely wrote: >>>>On 19/02/16 13:17 -0700, Sandra Loosemore wrote: >>>>>I suppose the patch is OK as it stands, but I was going to suggest >>>>>restructuring it so that it talks about the default behavior first >>>>>and what >>>>>it does with non-default -std= options after that, instead of >>>>>vice-versa. >>>>>Unfortunately I am backlogged on other things right now and it might >>>>>take me >>>>>a day or two before I have time to come up with some alternate >>>>>wording. If >>>>>we are in a rush, go ahead and commit the existing patch meanwhile, I >>>>>guess. >>>>Is this better? >>> >>>I believe your follow-up patch did not get committed, nor did I >>>see any response from anyone. >>> >>>To me it looks fine. Did you hold of intentionally, or did this >>>get lost for lack of responses? >>> >>>Sandra, what do you think? >> >>Looks OK to me. I apologize for losing track of this patch previously. :-( > >OK, thanks, I'll commit it today. I've committed the attached patch. --d6d1KVhp94hk3Jrm Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" Content-length: 2133 commit 77d4b96ba46e57a761e6844b89de9412011ef583 Author: Jonathan Wakely Date: Mon Mar 27 19:37:01 2017 +0100 Restructure -Wno-narrowing documentation * doc/invoke.texi (-Wno-narrowing): Reorder so default behavior is covered first. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 3f0eb2f..8d3821e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2869,10 +2869,17 @@ During the link-time optimization warn about type mismatches in global declarations from different compilation units. Requires @option{-flto} to be enabled. Enabled by default. -@item -Wnarrowing @r{(C++ and Objective-C++ only)} +@item -Wno-narrowing @r{(C++ and Objective-C++ only)} @opindex Wnarrowing @opindex Wno-narrowing -With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing +For C++11 and later standards, narrowing conversions are diagnosed by default, +as required by the standard. A narrowing conversion from a constant produces +an error, and a narrowing conversion from a non-constant produces a warning, +but @option{-Wno-narrowing} suppresses the diagnostic. +Note that this does not affect the meaning of well-formed code; +narrowing conversions are still considered ill-formed in SFINAE contexts. + +With @option{-Wnarrowing} in C++98, warn when a narrowing conversion prohibited by C++11 occurs within @samp{@{ @}}, e.g. @@ -2882,14 +2889,6 @@ int i = @{ 2.2 @}; // error: narrowing from double to int This flag is included in @option{-Wall} and @option{-Wc++11-compat}. -When a later standard is in effect, e.g. when using @option{-std=c++11}, -narrowing conversions are diagnosed by default, as required by the standard. -A narrowing conversion from a constant produces an error, -and a narrowing conversion from a non-constant produces a warning, -but @option{-Wno-narrowing} suppresses the diagnostic. -Note that this does not affect the meaning of well-formed code; -narrowing conversions are still considered ill-formed in SFINAE contexts. - @item -Wnoexcept @r{(C++ and Objective-C++ only)} @opindex Wnoexcept @opindex Wno-noexcept --d6d1KVhp94hk3Jrm--