From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 3CAAC385843A for ; Mon, 6 Nov 2023 12:32:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3CAAC385843A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3CAAC385843A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273950; cv=none; b=peqZ6sJv+VYTN/pDtGSgIdfYrlw/nrNdSoWbEWJMjzZDrpej8Fq2noaWROi1blaweZa3kIie721VCqQiAy/ioFq+s4kUFbNRv8bto3xfu8A/kt4Bx9dDxWajrNjZ/mPxo5uSkT1Puds861rDC2Lfxb/2z4d1MDgQb60Jet6mAo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699273950; c=relaxed/simple; bh=RE+rAEYWf0eWRUHAhWXJ5KZXIRatwx4560ucbDUX+xI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=s1rLtTCzW2qA1lh/Ex3mj+/jdl4azI4aOKRkaQ1MNxpfrQEbapOkYNiTbn1Zh+wWjBEN87639LKDlBcbumB6ZDlX+JF7/dHFrQ+iuGm6xJquEwt20DDDUwM41KRcGk4HX5pO7mtYbS/1ZZlz1VefceHbjj0n2wbJSeQSB1KHTgs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA893C15 for ; Mon, 6 Nov 2023 04:33:12 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6A8DB3F64C for ; Mon, 6 Nov 2023 04:32:28 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Re: [PATCH] attribs: Use existing traits for excl_hash_traits References: Date: Mon, 06 Nov 2023 12:32:27 +0000 In-Reply-To: (Richard Sandiford via Gcc-patches's message of "Tue, 29 Aug 2023 16:40:42 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-23.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Ping. Richard Sandiford via Gcc-patches writes: > excl_hash_traits can be defined more simply by reusing existing traits. > > Tested on aarch64-linux-gnu. OK to install? > > Richard > > > gcc/ > * attribs.cc (excl_hash_traits): Delete. > (test_attribute_exclusions): Use pair_hash and nofree_string_hash > instead. > --- > gcc/attribs.cc | 45 +++------------------------------------------ > 1 file changed, 3 insertions(+), 42 deletions(-) > > diff --git a/gcc/attribs.cc b/gcc/attribs.cc > index b8cb55b97df..0d4ab23aeb6 100644 > --- a/gcc/attribs.cc > +++ b/gcc/attribs.cc > @@ -2640,47 +2640,6 @@ namespace selftest > > typedef std::pair excl_pair; > > -struct excl_hash_traits: typed_noop_remove > -{ > - typedef excl_pair value_type; > - typedef value_type compare_type; > - > - static hashval_t hash (const value_type &x) > - { > - hashval_t h1 = htab_hash_string (x.first); > - hashval_t h2 = htab_hash_string (x.second); > - return h1 ^ h2; > - } > - > - static bool equal (const value_type &x, const value_type &y) > - { > - return !strcmp (x.first, y.first) && !strcmp (x.second, y.second); > - } > - > - static void mark_deleted (value_type &x) > - { > - x = value_type (NULL, NULL); > - } > - > - static const bool empty_zero_p = false; > - > - static void mark_empty (value_type &x) > - { > - x = value_type ("", ""); > - } > - > - static bool is_deleted (const value_type &x) > - { > - return !x.first && !x.second; > - } > - > - static bool is_empty (const value_type &x) > - { > - return !*x.first && !*x.second; > - } > -}; > - > - > /* Self-test to verify that each attribute exclusion is symmetric, > meaning that if attribute A is encoded as incompatible with > attribute B then the opposite relationship is also encoded. > @@ -2690,13 +2649,15 @@ struct excl_hash_traits: typed_noop_remove > static void > test_attribute_exclusions () > { > + using excl_hash_traits = pair_hash; > + > /* Iterate over the array of attribute tables first (with TI0 as > the index) and over the array of attribute_spec in each table > (with SI0 as the index). */ > const size_t ntables = ARRAY_SIZE (attribute_tables); > > /* Set of pairs of mutually exclusive attributes. */ > - typedef hash_set exclusion_set; > + typedef hash_set exclusion_set; > exclusion_set excl_set; > > for (size_t ti0 = 0; ti0 != ntables; ++ti0)