From patchwork Mon Nov 15 15:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1555330 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=) Received: from sourceware.org (server2.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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HtC886kqKz9s5P for ; Tue, 16 Nov 2021 02:01:43 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45CC63857C42 for ; Mon, 15 Nov 2021 15:01:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id DD0173858D39 for ; Mon, 15 Nov 2021 15:01:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DD0173858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: yGKYMhvJxB8aQE99MIbGjTXc425vim2P1MWuOiDqeiYo03q7H4V0ZM/+XbUExHSjyuRsHSOsV6 TNmCWy3jG2kRQFNWtLHMB7I0ReG+gyVapu9B2oEX+4LnqFZZIpYEy4QeExi5VAWO2u8rEOTVjb 1affWOsnVO2hTMqq3yFfbRZAgEJ9SL0HOQEPLYqjSpbd4RBRFZKVKQ9sxUXiCZ1Pa4Zdlr5XzG r3dPwS7f9utx3bvNVe2BVZhhRUX/KgDQOFqFaQ4FfbbZGc4KB0iHpgRhG/nGBCztO66MojAGD0 77KcTMutPd5Fe9uzFyqhrEwM X-IronPort-AV: E=Sophos;i="5.87,236,1631606400"; d="scan'208,223";a="68498716" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 15 Nov 2021 07:01:12 -0800 IronPort-SDR: gE+DOpV/Mn51oRKGVltBGCwe976bjIgZ1RZw6ytdf+/sKTnRREhh4sBQ3ozcJtG8TUm5Yht9El imTYSJ2nR8DAWw4Vskheru/FWGv1PJT2qg43fZTPB3FSHzPlWmk4bakVnPxfq8IdGu+oGSLPDh zhjbpRkjJ5CiaWr7Hgm6+LLMg+fum3JBNOqQaiHbYYVaSJOugGQfzlS6YOCfv/AL0d3luSZzId keHX11e8aidM1d/0nUA9TnfgkrrSgbcp0k/uRQwlFgHF09H6vBlzUQoNGC53oIW9Ut1ojR5NR9 uy8= From: Thomas Schwinge To: Martin Sebor , Subject: [ping] Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map' In-Reply-To: <87a6id76pn.fsf@euler.schwinge.homeip.net> References: <92db3776-af59-fa20-483b-aa67b17d0751@gmail.com> <47d06c821a53f5bd2246f0fca2c9a693bff6b882.camel@redhat.com> <3a5ea83c-0d91-d123-f537-f8f1223df890@gmail.com> <4514e92d166a007cdfd6b971a69a295a4d8b6891.camel@redhat.com> <015d6a49-d4d8-3ed8-d2b9-2999b466da55@gmail.com> <87y28gm6lt.fsf@euler.schwinge.homeip.net> <87h7f1o4f5.fsf@dem-tschwing-1.ger.mentorg.com> <87a6id76pn.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Mon, 15 Nov 2021 16:01:01 +0100 Message-ID: <87pmr1jweq.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi! Ping. Grüße Thomas On 2021-11-09T15:18:44+0100, I wrote: > Hi! > > On 2021-09-03T21:16:46+0200, I wrote: >> On 2021-09-01T18:14:46-0600, Martin Sebor wrote: >>> On 9/1/21 1:35 PM, Thomas Schwinge wrote: >>>> On 2021-06-23T13:47:08-0600, Martin Sebor via Gcc-patches wrote: >>>>> --- /dev/null >>>>> +++ b/gcc/diagnostic-spec.h >>>> >>>>> +typedef location_t key_type_t; >>>>> +typedef int_hash xint_hash_t; >> >>> By the way, it seems we should probably also use a manifest constant >>> for Empty (probably UNKNOWN_LOCATION since we're reserving it). >> >> Yes, that will be part of another patch here -- waiting for approval of >> "Generalize 'gcc/input.h:struct location_hash'" posted elsewhere. > > ... which I have now pushed, so I may now propose the attached patch to > "Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map'". OK to > push? > > > Grüße > Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From d346292fc95f1990abbc9f6a4a8eb89be0f0e88d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 31 Aug 2021 23:35:15 +0200 Subject: [PATCH] Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map' Instead of hard-coded '0'/'UINT_MAX', we now use the 'RESERVED_LOCATION_P' values 'UNKNOWN_LOCATION'/'BUILTINS_LOCATION' as spare values for 'Empty'/'Deleted', and generally simplify the code. gcc/ * diagnostic-spec.h (typedef xint_hash_t) (typedef xint_hash_map_t): Replace with... (typedef nowarn_map_t): ... this. (nowarn_map): Adjust. * diagnostic-spec.c (nowarn_map, suppress_warning_at): Likewise. --- gcc/diagnostic-spec.c | 4 ++-- gcc/diagnostic-spec.h | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/gcc/diagnostic-spec.c b/gcc/diagnostic-spec.c index 85ffb725c02..d1e563d19ba 100644 --- a/gcc/diagnostic-spec.c +++ b/gcc/diagnostic-spec.c @@ -107,7 +107,7 @@ nowarn_spec_t::nowarn_spec_t (opt_code opt) /* A mapping from a 'location_t' to the warning spec set for it. */ -GTY(()) xint_hash_map_t *nowarn_map; +GTY(()) nowarn_map_t *nowarn_map; /* Return the no-warning disposition for location LOC and option OPT or for all/any otions by default. */ @@ -163,7 +163,7 @@ suppress_warning_at (location_t loc, opt_code opt /* = all_warnings */, return false; if (!nowarn_map) - nowarn_map = xint_hash_map_t::create_ggc (32); + nowarn_map = nowarn_map_t::create_ggc (32); nowarn_map->put (loc, optspec); return true; diff --git a/gcc/diagnostic-spec.h b/gcc/diagnostic-spec.h index e54e9e3ddbe..368b75f3254 100644 --- a/gcc/diagnostic-spec.h +++ b/gcc/diagnostic-spec.h @@ -130,14 +130,9 @@ operator!= (const nowarn_spec_t &lhs, const nowarn_spec_t &rhs) return !(lhs == rhs); } -/* Per PR103157 "'gengtype': 'typedef' causing infinite-recursion code to be - generated", don't use - typedef int_hash xint_hash_t; - here. */ -struct xint_hash_t : int_hash {}; -typedef hash_map xint_hash_map_t; +typedef hash_map nowarn_map_t; /* A mapping from a 'location_t' to the warning spec set for it. */ -extern GTY(()) xint_hash_map_t *nowarn_map; +extern GTY(()) nowarn_map_t *nowarn_map; #endif // DIAGNOSTIC_SPEC_H_INCLUDED -- 2.33.0