From patchwork Wed Jun 5 12:21:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 91543 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 D48433936A97 for ; Wed, 5 Jun 2024 12:23:25 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 08DEE383E529 for ; Wed, 5 Jun 2024 12:21:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 08DEE383E529 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 08DEE383E529 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717590112; cv=none; b=NvasKYutaoiBpghiRBzrlWzScsHpbTg/jgOjMP8ZM3OFLvras2DMloPrsYZo1NBBfNJLlIkuFju6RXDRoDWpv8EaT2a+B3w0dxHvT/zRMxcFf7N5TJMF+JN/72W9ipsNsWAaWMOOxmSzGvqp9KS23z+OjrdaBCxi+gHiiSQ/AIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717590112; c=relaxed/simple; bh=ILL/oXbAr4rKpiLb+z6vO9Ja94PbjLScFulHoqDDJYU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=EFfDlm6oHqQIxw01ZsGpktQXa2TnDkqlPnwAGyfDRF4X64+vFcpX8a9qVhxj0A20PDnfGs/oFyZt8urj3Oc+dq8f+Is16AgZWQbcpKxf8Dn+8aIncmlk14RVfcZCdlQfN0PbfKyNglS230nsG4VhOTYgVD39WAcCX4Ym1aF6IIs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717590110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1rq50P62mYsPofAlAkVNfv0jywCMibYC1LS4K/7WAAM=; b=MYMXqeKyazj6YXWL16rOCLJisHTp+W+fq3azXc4pMTGzhXnjT8R/QComlsNVHNHiriCmIn ZMFyBq/sR9gJn6Z9H+FD6Z8ovHRMcPL65rkyhNWojKW6UqN4Qc9vowaaOYdP9l9OeeMFCh wFdX4/IwNufw7dJGxwjkrhXvdLQtvn0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-467-e6X4A_BWMyK6cxD3bGuA9g-1; Wed, 05 Jun 2024 08:21:49 -0400 X-MC-Unique: e6X4A_BWMyK6cxD3bGuA9g-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-35dc7e6e859so4276823f8f.2 for ; Wed, 05 Jun 2024 05:21:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717590108; x=1718194908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1rq50P62mYsPofAlAkVNfv0jywCMibYC1LS4K/7WAAM=; b=tA2W7nLpeA9hqCVlgeHVXyYpZY7S3TBnH5VjRlgLq8+JB2CeeqK/1K/ec3i1ZVCEGF KBC2ZszGHtxN6NnUV0cnF2Kl8e6FN6+I1fqKWqxPn2R9AfvPzyuW0YxxFmiK85EAmiHH 3uDfPxlF79zZAJ6B398Hn60UcxwCHxSgOqHA5rzwahKsfL6Rl+4FMI0bv+MPUYy+36iF hwgolK9r57Ei7yYDq9YzL7a+zqgBpnmgWCnhaVuoR82zX2HE5JLPyR+yPoIL5DKYPBl6 qrU2YF6WEV+5x9YeRS6WoUVyB34z3+DzUkrPb/gv9wpihOEwT+Q2wQiBr4pQMbBFilG4 nxYg== X-Gm-Message-State: AOJu0YybqmXteEFKXVysgKMZsyZUhNC9DtiDf5ZygzG3TMBAJHnUrDYB 1Y61kuOPsPJ7enirOSZx6SsBZsARxyFqHuaGV2S7rvp5hjwHHs7NFyFvBm4aURP14nfN1wDBBHT 4fX8FTo4bUuiLol2gizlU4ANPVbqt+KPNiR3hjObl+gyz1GCefuNp0aUY8B9T77An9iwtMnuZsq delxAOB5inccYtdygftC8S9pnG2Tvx0KxBXXNaDMk= X-Received: by 2002:a05:6000:11d0:b0:35e:7cd4:6d24 with SMTP id ffacd0b85a97d-35e840494a1mr1806335f8f.3.1717590108035; Wed, 05 Jun 2024 05:21:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoywIoYNH39ldA6pqaR9xdHd93dZYGW7DXG2nODgjHlyvUS5wKJId8Vkb8/18Z4tLiA6iirg== X-Received: by 2002:a05:6000:11d0:b0:35e:7cd4:6d24 with SMTP id ffacd0b85a97d-35e840494a1mr1806316f8f.3.1717590107542; Wed, 05 Jun 2024 05:21:47 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35e56669a23sm9901551f8f.83.2024.06.05.05.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:21:46 -0700 (PDT) From: Andrew Burgess To: binutils@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/2] opcodes/riscv: prevent future use of disassemble_info::fprintf_func Date: Wed, 5 Jun 2024 13:21:41 +0100 Message-Id: <1215eab73a27a9b19db2869dcc4dcdd821c97fa0.1717589992.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org The previous commit removed a use of disassemble_info::fprintf_func which had been added to the RISC-V disassembler after the disassembler had been switched to use ::fprintf_styled_func, for styled output. To prevent future mistakes, I propose adding a #define to rename fprintf_func to something which does not exist. If this had been in place then the before the previous commit libopcodes would have failed to compile, like this: ../../src/opcodes/riscv-dis.c: In function ‘print_reg_list’: ../../src/opcodes/riscv-dis.c:229:7: error: ‘disassemble_info’ {aka ‘struct disassemble_info’} has no member named ‘please_use_fprintf_styled_func_instead’ 229 | info->fprintf_func (info->stream, "%s", riscv_gpr_names[X_RA]); | ^~ If this commit is accepted then I'll follow up with another commit that adds the same #define to every disassembler that has been converted to use styled output. As the RISC-V disassembler is now fully styled, this commit should make no difference at all. --- opcodes/riscv-dis.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index d0d74c0a05a..0082f08b7fb 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -32,6 +32,11 @@ #include #include +/* The RISC-V disassembler produces styled output using + disassemble_info::fprintf_styled_func. This define prevent use of + disassemble_info::fprintf_func. */ +#define fprintf_func please_use_fprintf_styled_func_instead + /* Current XLEN for the disassembler. */ static unsigned xlen = 0;