From patchwork Thu Jun 1 03:18:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 101686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp19759vqr; Wed, 31 May 2023 20:19:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Jaut6UWhr47OM4AKGs1hP2qKmByIZ93U51FL+LqmXfsw7Holt1L60PfOhhDEZHZuooULU X-Received: by 2002:a17:906:6a27:b0:966:17b2:5b0b with SMTP id qw39-20020a1709066a2700b0096617b25b0bmr6895901ejc.49.1685589552837; Wed, 31 May 2023 20:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685589552; cv=none; d=google.com; s=arc-20160816; b=oQYPhNqfqA6W+2GVwYGq0h1snRNkYahrINxHc4OxIlZenkhfp7720hNWz5vZZ+9Vmf qXMO2IFz+F5/VNl8gi4nEhMSY/IyVWB7KwZBvR6FoX32dJMisr5YM/PXJqH2K8I5JkbT jN1Kij0dySyEIkjyfkicofYGAXRCxDJjzs1EooSPCo0p6JuIzFJR90gOmyucT5X7uNdj /UXf9agokQBDiyWPULn6f0VXJ18RpjAlfLV5DAixwravYwlu0Hgyms2Ezi5fFOnXFgc0 qfE2Im6xOXuB+KqsxdYx4CNt/bC2KvnPKrMm3ePIE36XzKrnGSPTv23FA+L4zg5qZMCR c/tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=jq6TMPG+ETXHFmOMHDfbYVZUCH2PEx+PE0JDJj4n4Ik=; b=jpCCaMu3b/Uf8kaHsGHaoLAiFeiLeDei8+fBYZKGB6ILE4E+AvvfnpEg+cqdJNrjDj SBRS7ZBXeW7TMinxeL1uHPyAX/RG5MMWgiHbXZFCxdebgLYBovAayh9/EF3EQBICUPVH XrhaQRXh4KONv5z615xSDDuvJ7Hlzr1TohKir05sOHgXD0wFyegN+pyZoFWxlPflah9j kElWUjKoS9dKFhZfkFBu8sT8rwcdYveXUizIV+VxgeHCcDD4uC5LKm7ptfPrA7SYobBS 8FYUU3moQ+Rof/sIwfCmTeNVTPTkYkH2hbhdRvGJRNt+aMpmFZh5gRGTFHnPwOYREZru UsIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gs4vKVDJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u12-20020a1709064acc00b0096f523eff33si10432208ejt.962.2023.05.31.20.19.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 20:19:12 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gs4vKVDJ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A0D43857BA4 for ; Thu, 1 Jun 2023 03:19:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A0D43857BA4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685589551; bh=jq6TMPG+ETXHFmOMHDfbYVZUCH2PEx+PE0JDJj4n4Ik=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=gs4vKVDJCQIiIzLVNh44AjUTfkD403gH2uKlG9B04s91QhA+4XbgOpZWemTXMZTne VPJLm946GLeCaDnerHqqD116+cVTCAy8AD3zNS2/KzEOHH4+rTboEnH4PexkL+vR4E tKCHbOF0RiGSZK1Jl1R3kwEUZ1KmS+gttkNihDg0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 674453858D20 for ; Thu, 1 Jun 2023 03:18:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 674453858D20 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-sqIJVc7sPcaKuASQhcE2Pg-1; Wed, 31 May 2023 23:18:23 -0400 X-MC-Unique: sqIJVc7sPcaKuASQhcE2Pg-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-75ca16028f4so33711085a.3 for ; Wed, 31 May 2023 20:18:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685589502; x=1688181502; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jq6TMPG+ETXHFmOMHDfbYVZUCH2PEx+PE0JDJj4n4Ik=; b=UcrluCUvENcLeWOC721yb7IiYDut3A4PPi6C5LoAIScL6km7XbeVvUTByPpHvVUFFf pqPyk4ooDSB7+/gUM/hSC2Z/08x7xLvU0a/+QiYMNatrIF1g2X2g/Ycr9owc30tTkVWV pV0HwKaGmQJ3z6E2TctHQ+BQ8SdfsXsG5YkhK5wogAezEIaKRLgmgKcdhH0aECWdvVv4 6VCpUtIOfJhmhGHxZYzoQfpSlV1rvvSm0twheS7Z3sq2+Qv9mWiatrbgK8r3AHUPoQSw jGcbmWeN5BrGgLTTH1erIBH4/6qkJ3quUoyfDzMOrmuueYa/5zPjXzGsE4RlGEvecAYH 1Mng== X-Gm-Message-State: AC+VfDxw1mg2Y1Qo9TbUmer7/n8lo0ONMGlznFfwLyMUNlmphOuiezCP AwDDvRUYvfjr5DFO528XynLcp9kENEWONyUGffrvV/2/9TjqmyhHcWv45ZOLM4PSxxB0zFXilHv qmHKH03wfMEF/fof0flkLqQl9ZxCLDFu6msPRK9jNC/uv3zo0UyJebr7JCNirW8ebuPRwwVDfDQ == X-Received: by 2002:a05:620a:6412:b0:75b:23a0:d9ea with SMTP id pz18-20020a05620a641200b0075b23a0d9eamr7854126qkn.64.1685589502465; Wed, 31 May 2023 20:18:22 -0700 (PDT) X-Received: by 2002:a05:620a:6412:b0:75b:23a0:d9ea with SMTP id pz18-20020a05620a641200b0075b23a0d9eamr7854118qkn.64.1685589502064; Wed, 31 May 2023 20:18:22 -0700 (PDT) Received: from jason.com (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id f5-20020a05620a068500b00759554bbe48sm6076157qkh.4.2023.05.31.20.18.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 20:18:21 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: make -fpermissive avoid -Werror=narrowing Date: Wed, 31 May 2023 23:18:19 -0400 Message-Id: <20230601031819.1271768-1-jason@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767468751200104755?= X-GMAIL-MSGID: =?utf-8?q?1767468751200104755?= Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- Currently we make -Wnarrowing an error by default by forcing pedantic_errors on, but for consistency -fpermissive should prevent that. In general I'm inclined to move away from using permerror in favor of this kind of model, with specific flags for each diagnostic. gcc/cp/ChangeLog: * typeck2.cc (check_narrowing): Check flag_permissive. --- gcc/cp/typeck2.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) base-commit: 09ff83d4bc1405c9af803fb84bfc49d6001da47b diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index 8724877058f..1c204c8612b 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -1109,7 +1109,8 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, else if (complain & tf_error) { int savederrorcount = errorcount; - global_dc->pedantic_errors = 1; + if (!flag_permissive) + global_dc->pedantic_errors = 1; auto s = make_temp_override (global_dc->dc_warn_system_headers, true); pedwarn (loc, OPT_Wnarrowing, "narrowing conversion of %qE from %qH to %qI",