From patchwork Tue Nov 9 14:18:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 47286 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A575385842F for ; Tue, 9 Nov 2021 14:19:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 34667385800F for ; Tue, 9 Nov 2021 14:18:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 34667385800F 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: Z5Fa9AxcfTzhMB8drOeT5r1XdMgIROeHz+dbFDFjVD0mvc6GhU7jy4aHnxevQcaw0PdhmjmKHR 14ohVg+T4xuzTRmt5nMYJ8HVhoY6aF4nYbB7BXtyw2udILYWXD05t7Zk9wQEDTuyza1iI0adLA 1RvR/AMX+Fds7dqdmB4JDDfXkSsagrb0ieKXz1q9g6+Fyxi7aavxi2wnWrhkWJi2+cT1yxcbLc 9mNZhtVUVZ1JEerPNWObk2Icj0xLpJs0aOHqiYR9Dy1q+iLS/OGOLS2r7Cu7Me0CqIR69IyDYp 6q6Ou2DAGEXfD/8fFts9iKrH X-IronPort-AV: E=Sophos;i="5.87,220,1631606400"; d="scan'208,223";a="70723282" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 09 Nov 2021 06:18:54 -0800 IronPort-SDR: y16oBCUFK5OXx6sETCoto03EXFiamBOD/1cBfZvhz5RXBMlr9i3ooM7V83bngmeJHSdAf5WU7/ pKyg/AK/kOagBFu8iGg11I7FDGjDGew4JnfVqJdA3/IV+as0fQysLHTO5Ht+GehVNsGvu2TYTp 7V2mW7z73NgYT8OpkhyZRtBl61wN1U2IKuAKd51HJAV9ju2HpjM0B9eu5dc7IWexrp6nwFNIQf On4819+1jvUKBSLqX8TXiiRvgrvbW9WwRObWajsW1sFyJjz6JQoCYFU+pRCI3gRTBS5JbL5m7y o7Y= From: Thomas Schwinge To: Martin Sebor , Subject: Use 'location_hash' for 'gcc/diagnostic-spec.h:nowarn_map' (was: [PATCH 1/13] v2 [PATCH 1/13] Add support for per-location warning groups (PR 74765)) In-Reply-To: <87h7f1o4f5.fsf@dem-tschwing-1.ger.mentorg.com> 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> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Tue, 9 Nov 2021 15:18:44 +0100 Message-ID: <87a6id76pn.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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