From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YfNrImefYGo3ziQAWB0awg (envelope-from ) for ; Wed, 22 Jul 2026 06:45:59 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kSm1SM1b; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7F6E61E09E; Wed, 22 Jul 2026 06:45:59 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 278631E09B for ; Wed, 22 Jul 2026 06:45:57 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C3BCF4BA2E14 for ; Wed, 22 Jul 2026 10:45:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3BCF4BA2E14 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kSm1SM1b Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azlp170100001.outbound.protection.outlook.com [IPv6:2a01:111:f403:c110::1]) by sourceware.org (Postfix) with ESMTPS id 29E904BA2E27 for ; Wed, 22 Jul 2026 10:42:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29E904BA2E27 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 29E904BA2E27 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c110::1 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784716979; cv=pass; b=rZBwNfrPr+sPPHasafqrs8Iu9XK5tXkYqLJuoUIuannB9BGl2Ur/OZ7RdZEu3zk3AkffKjqC0ETR5Em3KQryOtksNu/OLFlcDgSggPCd1uFlpCNX3B6uBjqJwePb8LaifhYvVak7iBVRcwjCdMAijRC+3ofApF1JkD+1jOuJpnM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784716979; c=relaxed/simple; bh=5lT9RWkQbOv78bt7C4S022gjxgEEukr/POafPZzZnSc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PxVcwFGRnS1eNUfiFg5wZsuyhp/1CpyYTr/Pz4TuJCbZ3WK+40UjpLezrlCt8yybwox8A3SbKEkpYkh7j0LClF8/ukVdmkj0nU11Bk8JgWGmkxumKFQaWL2QpEvkfqfrT/R7MPB5/y2nmAMaN1oDwAsXfxIpdSKL3ogOmkDY9o0= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kSm1SM1b DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29E904BA2E27 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BhV/qLn6becp9iB6jOhqPM8I4aN62vflFCvA4YxnmSZMtD3e54EPLmVXYjnEGgKR3RPBl4+687rcQyAXFqiI/fcJuUWclI5G6yo/OuNN0nAU6t3BPCH84kFh55W7wHsoZ2na0JIUDjGI54rdbcuOY+hYlX2//jxpU7dQ4HmPy5T0kWM04roqF2JHy0MyNf0jK+EeWcONIIw+edbyvHUyZcjbsbnwlB13qLG0xTDku0CK9FNmzbjaVVDadjf/i9GEjYJp0W0z5cEFUvvIsbGxLJySqVmxYLiFLQrcABVJXaI24aEKVhKsQoPhWfaArEYpnxK50bKU0W8HypyOZrW78A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hl67BXhdfMJ3CMwHCWLrn/M15smn1S3JDauHaGNkghU=; b=WJ2qBMu40yOPjBQgH+5VTQMKWieQDU2E9sGk/ZsE+4GGofj3n0x+pJLBW3hv4jpQbdy0Q/9Mz1qeJl2UB0nIFsHcYDcIaysqnfKXY2ajGVz41cO2vyUBSBNF8dMliyz8oRoQo0xxvwlWCLomedme9HjNh7ndqn5yeMi50ldxrIJVSEjgbpDgfbIWbtlus4+kc10LZEvJwy1YWiqgMOt+CLGKfjtvnf/xXI7WRaDC9waX8JcreEK/ajwP5Xwcmk3Oyq5TP9PrFs7aQvsWAnhV3LQzdX3Irh8DS4cWj7IIIOPuvZUmee6vqIHjZLwlL6pPjIbNmknOCVNlCRpzu72dSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hl67BXhdfMJ3CMwHCWLrn/M15smn1S3JDauHaGNkghU=; b=kSm1SM1bLSljgZ7TkfLlCVMQykLErVPdiRp9ZDuIUpaAhkUju1IuH2waq8E8fJ/+vCZwuQaEwHE8zq7VwA2/WCWF6fSi6XZW7JTNJH7lWn8KOpZf7U1uNb4+ZfmTU9rY6y/KSeAv0CZ1RhOzf9ayyt+PTHBP6bUU7zueiqx0jEo= Received: from CH0PR03CA0095.namprd03.prod.outlook.com (2603:10b6:610:cd::10) by SJ5PPF000ACABD1.namprd12.prod.outlook.com (2603:10b6:a0f:fc02::984) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10; Wed, 22 Jul 2026 10:42:50 +0000 Received: from CH3PEPF00000013.namprd21.prod.outlook.com (2603:10b6:610:cd:cafe::1d) by CH0PR03CA0095.outlook.office365.com (2603:10b6:610:cd::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.245.10 via Frontend Transport; Wed, 22 Jul 2026 10:42:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH3PEPF00000013.mail.protection.outlook.com (10.167.244.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.0 via Frontend Transport; Wed, 22 Jul 2026 10:42:49 +0000 Received: from ctr-rack32-mi300x-1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Wed, 22 Jul 2026 05:42:45 -0500 From: Tankut Baris Aktemur To: CC: Subject: [PATCH v2 14/17] gdb: convert TYPE_RESTRICT macro to type::is_restrict Date: Wed, 22 Jul 2026 05:42:03 -0500 Message-ID: <20260722-users-aktemur-type-instance-flags-v2-14-d60dcbc2a76f@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260722-users-aktemur-type-instance-flags-v2-0-d60dcbc2a76f@amd.com> References: <20260722-users-aktemur-type-instance-flags-v2-0-d60dcbc2a76f@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15.0 Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000013:EE_|SJ5PPF000ACABD1:EE_ X-MS-Office365-Filtering-Correlation-Id: 203890bd-709b-4830-3957-08dee7ddf9ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700016|376014|1800799024|23010399003|11063799006|56012099006|10067099003|18002099003|22082099003|6133799003; X-Microsoft-Antispam-Message-Info: HNk2ZFFJdzd/vt/Kg/u35joRPQ96l+JF70zMJ2Dywp84hGn1XGeclpN+3h1w+BS2LELZMBvEaSLt49+UA9k0Ax6wQv1C+tDAS5AtqBwRq8S/bVcEh3JBVZkjRoVFHKUkoRr0A5TeFSssDmRu+YBelMWTVQB0OZKqTKJUv86Wkpv+QzBsoPSIQS7JVDmDVd02r8XJvKmWnB8usP9N2wDZPZ9NwfuCn28iRtFBIIUEbAedo37JVkGuL4f1CGeU9+e6nhA/0IB8orvUsieBuIxYJfs3PQh2OQ4tyfXPHRruFV1TUh3CzPQCLLgHLJNZq/aB4Zegd7p3xvGqov/9VxUOZd9QxRV40QDou1i92KXL13tEiJO8axU76L1WWNeMzbE2u0eXBpwJqFVyvpl4gR62NtQO5pZiMVrVof+OszKaGk42pvtGKAfuj19SQ8vEWdvi/Og8R3Xv68Imm2ZHZ9vzRurTRatQOJnQhs6z9CnwSwTLH44xUmqHGQV4umdUqzTO2OJfVBkbM+m+qrksf76hfafIXzUHd5QQPgCYDW/ZwqKIX8ywMyYqgTzD8LERh7UiCM3a1zmTqhzw7OMTfGYslTEsE9Yico88khVmqtNGKPVhEXb/TY42LRGNwXrgEi/X7xiLUQQTqvFc8zSFJm4aRq87V6cNLqxszO9+25mtn6a51eAxQxK3upwb4H3cyLwuBuY0H30qM1PoB4WdduET+A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700016)(376014)(1800799024)(23010399003)(11063799006)(56012099006)(10067099003)(18002099003)(22082099003)(6133799003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e0ltZbAucdJuCQSFLCtp0liCw+xy7FXmkH90WvFYyVnxUrsUnw/sYoG45+ExvoKH0sPv9QZ1HbtJrWRY+w68314SUqDG4VFeMLSHIfg2MWSNbjdpwjVR0VzO2b4hKKS66XpdJrYrkFg8xGxmTQUAMeF/4vHS3ogyjUoSy7IRwRFaZixDHC4kPI9mOHZRo1R3HVwlBzj03JkhNXo9VxGNiHg3NaPyfFaexx4A3OUGFL6IJ8+xklxoTA6a5uv89uy6P/nY5CUvFlceslw1ESLDU7E5JTjEZgGsWbZeQg7zUfdppTb2qwI90AHZY1T9HgnirCAAApk4fH55PsVTJSBGrhuEyQEYgG2Wn5D8S5LSnV5QoEqdnX/dUHEtMMyIBCyETxzmxJCgUXCdChMSS3Rpl75hBXXiSjb9PZEBqGEKMsZOmYyIA2kYjcIy00nZW6as X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2026 10:42:49.5317 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 203890bd-709b-4830-3957-08dee7ddf9ad X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000013.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPF000ACABD1 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Convert the TYPE_RESTRICT macro to a method of the type class. This is a refactoring. --- gdb/c-typeprint.c | 4 ++-- gdb/compile/compile-c-types.c | 4 ++-- gdb/compile/compile-cplus-types.c | 6 +++--- gdb/gdbtypes.c | 6 ++---- gdb/gdbtypes.h | 7 ++++++- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index d26640e10e6..1c3b0fba04d 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -317,7 +317,7 @@ cp_type_print_method_args (struct type *mtype, if (domain->is_volatile ()) gdb_printf (stream, " volatile"); - if (TYPE_RESTRICT (domain)) + if (domain->is_restrict ()) gdb_printf (stream, (language == language_cplus ? " __restrict__" : " restrict")); @@ -465,7 +465,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream, did_print_modifier = 1; } - if (TYPE_RESTRICT (type)) + if (type->is_restrict ()) { if (did_print_modifier || need_pre_space) gdb_printf (stream, " "); diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 2c115632a7c..818cdecd50d 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -251,7 +251,7 @@ convert_qualified (compile_c_instance *context, struct type *type) quals |= GCC_QUALIFIER_CONST; if (type->is_volatile ()) quals |= GCC_QUALIFIER_VOLATILE; - if (TYPE_RESTRICT (type)) + if (type->is_restrict ()) quals |= GCC_QUALIFIER_RESTRICT; return context->plugin ().build_qualified_type (unqual_converted, @@ -278,7 +278,7 @@ convert_type_basic (compile_c_instance *context, struct type *type) { /* If we are converting a qualified type, first convert the unqualified type and then apply the qualifiers. */ - if (type->is_const () || type->is_volatile () || TYPE_RESTRICT (type)) + if (type->is_const () || type->is_volatile () || type->is_restrict ()) return convert_qualified (context, type); switch (type->code ()) diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 787ca321a5f..8352c9324f4 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -673,7 +673,7 @@ compile_cplus_convert_method (compile_cplus_instance *instance, quals |= GCC_CP_QUALIFIER_CONST; if (method_type->is_volatile ()) quals |= GCC_CP_QUALIFIER_VOLATILE; - if (TYPE_RESTRICT (method_type)) + if (method_type->is_restrict ()) quals |= GCC_CP_QUALIFIER_RESTRICT; /* Not yet implemented. */ @@ -1070,7 +1070,7 @@ compile_cplus_convert_qualified (compile_cplus_instance *instance, quals |= GCC_CP_QUALIFIER_CONST; if (type->is_volatile ()) quals |= GCC_CP_QUALIFIER_VOLATILE; - if (TYPE_RESTRICT (type)) + if (type->is_restrict ()) quals |= GCC_CP_QUALIFIER_RESTRICT; return instance->convert_qualified_base (unqual_converted, quals); @@ -1126,7 +1126,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance, { /* If we are converting a qualified type, first convert the unqualified type and then apply the qualifiers. */ - if (type->is_const () || type->is_volatile () || TYPE_RESTRICT (type)) + if (type->is_const () || type->is_volatile () || type->is_restrict ()) return compile_cplus_convert_qualified (instance, type); switch (type->code ()) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 731c7436dc6..a682d525134 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5033,10 +5033,8 @@ recursive_dump_type (struct type *type, int spaces) { gdb_printf (" TYPE_ADDRESS_CLASS(%u)", TYPE_ADDRESS_CLASS (type)); } - if (TYPE_RESTRICT (type)) - { - gdb_puts (" TYPE_RESTRICT"); - } + if (type->is_restrict ()) + gdb_puts (" TYPE_RESTRICT"); if (TYPE_ATOMIC (type)) { gdb_puts (" TYPE_ATOMIC"); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index b6c3b219419..0acfda0d74b 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -168,7 +168,6 @@ struct type_instance_flags bool is_atomic : 1; }; -#define TYPE_RESTRICT(t) (((t)->instance_flags ()).is_restrict) #define TYPE_ATOMIC(t) (((t)->instance_flags ()).is_atomic) /* True if this type represents either an lvalue or lvalue reference type. */ @@ -1222,6 +1221,12 @@ struct type return this->m_instance_flags.harvard_aspace == HARVARD_ASPACE_DATA; } + /* Return if this type is restrict. */ + bool is_restrict () const + { + return this->m_instance_flags.is_restrict; + } + /* Get the bounds bounds of this type. The type must be a range type. */ range_bounds *bounds () const { -- 2.34.1