From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121837 invoked by alias); 28 Feb 2020 16:59:04 -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 121553 invoked by uid 89); 28 Feb 2020 16:59:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1017, H*i:sk:f726a43, H*MI:sk:f726a43, 93824 X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Feb 2020 16:59:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582909141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1p1AcgFF7J4or2JOHR7i8HmOCzEzLQuSEqMOJ+pJw38=; b=DDfEb+V5hTW1N0N2ZE6zdbq57BVGPwB2uchpOCXqjFazcN6hVYxt2VV93gPSaEst+qyqrC p7x42/JmAOrKOPSXxy5KtApcnwpSfdBVE5rmuNqKc55e9vNFhFrHxA7yoC9Qy6VSpX8MzI 0QJqZ46VYuDV75igW86pjrK7uQmx800= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-iEv4zT55Oi-iXzfN_7tAyA-1; Fri, 28 Feb 2020 11:58:58 -0500 Received: by mail-qt1-f197.google.com with SMTP id o24so3386374qtr.17 for ; Fri, 28 Feb 2020 08:58:58 -0800 (PST) Return-Path: Received: from [192.168.1.148] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id k4sm5198516qkk.90.2020.02.28.08.58.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Feb 2020 08:58:57 -0800 (PST) Subject: Re: [PATCH] avoid -Wredundant-tags on a first declaration in use (PR 93824) To: Martin Sebor , gcc-patches References: From: Jason Merrill Message-ID: <010f6d68-a64e-45a4-744e-c040a4ea94d6@redhat.com> Date: Fri, 28 Feb 2020 16:59:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg01642.txt.bz2 On 2/24/20 6:58 PM, Martin Sebor wrote: > -Wredundant-tags doesn't consider type declarations that are also > the first uses of the type, such as in 'void f (struct S);' and > issues false positives for those.=C2=A0 According to the reported that's > making it harder to use the warning to clean up LibreOffice. >=20 > The attached patch extends -Wredundant-tags to avoid these false > positives by relying on the same class_decl_loc_t::class2loc mapping > as -Wmismatched-tags.=C2=A0 The patch also somewhat improves the detection > of both issues in template declarations (though more work is still > needed there). > + a new entry for it and return unless it's a declaration > + involving a template that may need to be diagnosed by > + -Wredundant-tags. */ > *rdl =3D class_decl_loc_t (class_key, false, def_p); > - return; > + if (TREE_CODE (decl) !=3D TEMPLATE_DECL) > + return; How can the first appearance of a class template be redundant? Jason