From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6445 invoked by alias); 25 Jul 2017 12:04:45 -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 127396 invoked by uid 89); 25 Jul 2017 12:04:39 -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=14pm, 14PM 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; Tue, 25 Jul 2017 12:04:38 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07E9E769EC; Tue, 25 Jul 2017 12:04:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 07E9E769EC 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=polacek@redhat.com Received: from redhat.com (ovpn-204-38.brq.redhat.com [10.40.204.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2398C8E832; Tue, 25 Jul 2017 12:04:35 +0000 (UTC) Date: Tue, 25 Jul 2017 12:04:00 -0000 From: Marek Polacek To: Volker Reichelt Cc: gcc-patches List , David Malcolm Subject: Re: [PATCH v2] New C++ warning option '-Waccess-specifiers' Message-ID: <20170725120425.GE3397@redhat.com> References: <1500652589.7686.31.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-SW-Source: 2017-07/txt/msg01538.txt.bz2 On Sun, Jul 23, 2017 at 11:22:14PM +0200, Volker Reichelt wrote: [...] Not sure if the warning is too useful, but in any case... > + /* Emit warning. */ > + gcc_rich_location richloc (token->location); > + richloc.add_fixit_remove (); > + if (colon_token->type == CPP_COLON) > + richloc.add_fixit_remove (colon_token->location); > + > + switch (message_id) > + { > + case 1: > + warning_at_rich_loc (&richloc, OPT_Waccess_specifiers_, > + "redundant %qE access-specifier", > + token->u.value); > + inform (next_token->location, "directly followed by another one here"); > + break; > + > + case 2: > + warning_at_rich_loc (&richloc, OPT_Waccess_specifiers_, > + "duplicate %qE access-specifier", > + token->u.value); > + inform (current_access_specifier_loc, > + "same access-specifier was previously given here"); > + break; ...you should only call inform if warning_at_rich_loc returned true. Marek