From patchwork Thu Jun 3 14:42:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1487277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=JlAXCVmE; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FwpYN6gJWz9s24 for ; Fri, 4 Jun 2021 00:43:36 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BEE63835833 for ; Thu, 3 Jun 2021 14:43:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BEE63835833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1622731414; bh=VIHjQ/npNEQ0W6tm4DiQf1z8cE5aq4AQLHFLxq9MkHs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JlAXCVmEnb45uE35a2fcW4UxMvDDOfrnCa4X3FAV51vM1bEfzzGQI3e4O7ZqV7UIE 9KPXls7BbzsxEFcfqLEzh5ZJLUG6hFOADdh4YOHu7V/MQu0g0GY/Aev8W7OTCHi/9U Mvf/Ktd3+oUzHBVU8dvdv98pjoEWizjLXgYMbSCE= 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 ESMTP id 1C0C4383B420 for ; Thu, 3 Jun 2021 14:42:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1C0C4383B420 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-232--VKDPfFfM5yl9kZs1OhS9Q-1; Thu, 03 Jun 2021 10:42:20 -0400 X-MC-Unique: -VKDPfFfM5yl9kZs1OhS9Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 883AA196632D for ; Thu, 3 Jun 2021 14:42:18 +0000 (UTC) Received: from t14s.localdomain.com (ovpn-112-42.phx2.redhat.com [10.3.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DDD319704; Thu, 3 Jun 2021 14:42:18 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [committed] diagnostic-show-locus: tweak rejection logic Date: Thu, 3 Jun 2021 10:42:11 -0400 Message-Id: <20210603144211.684385-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.5 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_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as 4bdc6e17c9dc621f9502a84abceb2e17ae0418f8. gcc/ChangeLog: * diagnostic-show-locus.c (diagnostic_show_locus): Don't reject printing the same location twice if there are fix-it hints, multiple locations, or a label. Signed-off-by: David Malcolm --- gcc/diagnostic-show-locus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 4111cd66544..24bd0313126 100644 --- a/gcc/diagnostic-show-locus.c +++ b/gcc/diagnostic-show-locus.c @@ -2600,9 +2600,11 @@ diagnostic_show_locus (diagnostic_context * context, return; /* Don't print the same source location twice in a row, unless we have - fix-it hints. */ + fix-it hints, or multiple locations, or a label. */ if (loc == context->last_location - && richloc->get_num_fixit_hints () == 0) + && richloc->get_num_fixit_hints () == 0 + && richloc->get_num_locations () == 1 + && richloc->get_range (0)->m_label == NULL) return; context->last_location = loc;