From patchwork Sat Jun 29 22:06:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=MsgwJeHk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WBRHq6Xt8z20bN for ; Sun, 30 Jun 2024 08:07:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84AFB389F4FF for ; Sat, 29 Jun 2024 22:07:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id B1D8A389EC9A for ; Sat, 29 Jun 2024 22:07:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B1D8A389EC9A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B1D8A389EC9A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698825; cv=none; b=v+gyPv38V9O/BOZ4PdNBGHf4SibXui3yG2UxuKRgA95slN1FWY2dhNOM0yqecGMbDVvZy9aDFDGYvzPR3oHSzIencgKRUpfDrdSJOyASGuJWaVe+wKCoGe4Mhbi1gJiwR2jhEG5Y0nfcEXGOthwdAHMu4KlzR6AEpSsxwR6iTtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698825; c=relaxed/simple; bh=tf1TbdvoBAFBzwdurbQBb7pjrONKMuPdI9wdQQxcZ3c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=b2MP8eS73OnnZrGfFB29W2b/M4o4zJ2MZkuUT4Dh5ZfrzbmRfpUsE7SEcPDkR62O/fP7Q72jTSQb61WIzlYCvEK+g4WTmdNNDZsJJ/NtNtOmw0r6kZ/kNzvpf/6+XB9RaJKAT1Wqm155GPOsXKeSQ5br974tzozj3MwxC0ddHaI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id D3D543DA80EF; Sat, 29 Jun 2024 23:07:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698822; bh=dSKEMsHeho0LJv6ze3aKt/vCnO9QX4+zgU8hYQJtkhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MsgwJeHkPQpryr63dFhNrHEHyNGI01/CQu2eKEwwP3K+S0Jtq5lkvWx/yzixIiQZH U2rHUL1WvfJLtKd85UsrgT0QaXvb8w2qJzkPCh6pgEcASQa7e+6rW9GlVo1jAM0Vzd KH1k5/zVJ/NFvE/69PfEq+XZUv0duEz3OixkGkrw= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 3/5] Avoid magic numbers when writing CodeView padding Date: Sat, 29 Jun 2024 23:06:51 +0100 Message-ID: <20240629220653.4445-3-mark@harmstone.com> In-Reply-To: <20240629220653.4445-1-mark@harmstone.com> References: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 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 Adds names for the padding magic numbers to enum cv_leaf_type. gcc/ * dwarf2codeview.cc (enum cv_leaf_type): Add padding constants. (write_cv_padding): Use names for padding constants. --- gcc/dwarf2codeview.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index 921d5f41e5a..71049ccf878 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -77,6 +77,9 @@ enum cv_sym_type { /* This is enum LEAF_ENUM_e in Microsoft's cvinfo.h. */ enum cv_leaf_type { + LF_PAD1 = 0xf1, + LF_PAD2 = 0xf2, + LF_PAD3 = 0xf3, LF_MODIFIER = 0x1001, LF_POINTER = 0x1002, LF_PROCEDURE = 0x1008, @@ -1037,7 +1040,7 @@ write_lf_pointer (codeview_custom_type *t) /* All CodeView type definitions have to be aligned to a four-byte boundary, so write some padding bytes if necessary. These have to be specific values: - f3, f2, f1. */ + LF_PAD3, LF_PAD2, LF_PAD1. */ static void write_cv_padding (size_t padding) @@ -1048,19 +1051,19 @@ write_cv_padding (size_t padding) if (padding == 3) { fputs (integer_asm_op (1, false), asm_out_file); - fprint_whex (asm_out_file, 0xf3); + fprint_whex (asm_out_file, LF_PAD3); putc ('\n', asm_out_file); } if (padding >= 2) { fputs (integer_asm_op (1, false), asm_out_file); - fprint_whex (asm_out_file, 0xf2); + fprint_whex (asm_out_file, LF_PAD2); putc ('\n', asm_out_file); } fputs (integer_asm_op (1, false), asm_out_file); - fprint_whex (asm_out_file, 0xf1); + fprint_whex (asm_out_file, LF_PAD1); putc ('\n', asm_out_file); }