From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dLTTLCrDvmrsWCUAWB0awg (envelope-from ) for ; Thu, 01 Oct 2026 16:31:38 -0400 Received: by simark.ca (Postfix, from userid 112) id 892F01E051; Thu, 01 Oct 2026 16:31:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED 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 A48BC1E04E for ; Thu, 01 Oct 2026 16:31:36 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CD9964BB3B80 for ; Thu, 1 Oct 2026 20:31:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD9964BB3B80 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 1D2AB4BB24E4 for ; Thu, 1 Oct 2026 20:31:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1D2AB4BB24E4 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1D2AB4BB24E4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790886674; cv=none; b=J1L6Dmc0g87orNVu8ESOMou2fuKFdLHgkBqwBY/d/6rr2llw/f15+EypQxmbpVQmsCG0HJcYv6CX40w5hJ7RJQGJ76L8ZajhFCntO7wbsyEykP+ExamjUUNmxjNDUIyVH88K22pTyebbNoSRJ1aCoBCV+Fz+SmzO4hyf9Sm8Zdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790886674; c=relaxed/simple; bh=6UuEZtmd6V2dup/9YU1oFYmKyhqsH34fZCKk81Dyueg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Hl0vm6g++DA5ZmQCnsCCVwy5E6YheY/DVyw+EBPMECeRiyjRyqYNOZxMAXujOcWWta09D5hZa1egMfjFrPdBhBDd2wRvZ8vCdp08ptBNo3438sB8kalxMnnt/a+Zp90UtdxNblsoNLrOwtC7zyW99C8BKtmQrTcL0oMXGOFIzGM= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D2AB4BB24E4 Received: by simark.ca (Postfix) id 1C5001E051; Thu, 01 Oct 2026 16:31:12 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 3/7] gdb: convert d_left and d_right macros into functions Date: Thu, 1 Oct 2026 16:30:01 -0400 Message-ID: <20261001203105.1379971-4-simon.marchi@efficios.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261001203105.1379971-1-simon.marchi@efficios.com> References: <20261001203105.1379971-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Replace the d_left and d_right macros with static inline functions. They need to return a reference, because some callers assign to the result: d_right ($1.last) = $2; and some take the address: $$.last = &d_right ($$.comp); Change-Id: I7d8bd71ffde82a0fdfd2e2dcb87461043f82ef4f --- gdb/cp-name-parser.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gdb/cp-name-parser.h b/gdb/cp-name-parser.h index 083631f20a67..f9d3a6968f9d 100644 --- a/gdb/cp-name-parser.h +++ b/gdb/cp-name-parser.h @@ -26,8 +26,21 @@ union cp_name_parser_YYSTYPE; struct demangle_parse_info; -#define d_left(dc) (dc)->u.s_binary.left -#define d_right(dc) (dc)->u.s_binary.right +/* Return a reference to the left child of binary component DC. */ + +static inline struct demangle_component *& +d_left (struct demangle_component *dc) +{ + return dc->u.s_binary.left; +} + +/* Return a reference to the right child of binary component DC. */ + +static inline struct demangle_component *& +d_right (struct demangle_component *dc) +{ + return dc->u.s_binary.right; +} namespace cp_name_parser { -- 2.55.0