From patchwork Fri Apr 28 16:02:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 68501 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 ACBA53856DC7 for ; Fri, 28 Apr 2023 16:03:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACBA53856DC7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682697804; bh=P+Pn96p+jSBxz9AE7mCHOGBhhPLgPJrTeF79fuGPc/4=; h=Date:Subject:References:In-Reply-To:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Z7GIkDdreaOhnNIOl8wWGG4P9PR0h9l5c6xTrIZC80Hcjw1zKNKxkCpORORbYgcZQ 8gL9odZ2y66ixJRQG1ED31GsKKLS7742Ejfndw1j5Vp2T7JrRoHnlckL04LlDczfe0 D/MsslUvvAhIqRbLv1cH++n3EWrh4I5AF7WqjeYM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 8ED443858CDB for ; Fri, 28 Apr 2023 16:02:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8ED443858CDB Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-32f397b44dcso18387725ab.1 for ; Fri, 28 Apr 2023 09:02:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682697775; x=1685289775; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P+Pn96p+jSBxz9AE7mCHOGBhhPLgPJrTeF79fuGPc/4=; b=Vgjb7Kv8htjhmTcCMuwP/u6sTBEcdnjCJjljdgoJRPiYRqNWFshZdj4r0S31X9V+eG pWEaw8fpvm9Pvk8gm8URHN9hQtY7ynjqyokH3Z/5W3tnofFHZ3XA/VIcy5zOQZjvBSSF c+bBu8jcrHyfVgmXdFgtvGEYnaf7+zE1TIZ1+0AXvy+Haq5r4npLPSmG50Dl/+E6Ba/K mKdCIso+C0NOLYhu3VOB2Dqj8q4P2GXSpaVsmeGLYWMqleWS22J/YK6Eklicve9igA3X qXl5mqHESlTaSTw9DiC+zPWup3UMpxWEf7sWG64d0xj5gM2mOWvUVC2VCBc6QOfG007P WGlg== X-Gm-Message-State: AC+VfDwmUj+92ZhwXthEzuk86yrgLqT2p092YYhbXSIZBt0hxO/q46M4 h3zFG/wkdBDX00Z+BFpvFsj7enDiHvaowR/7xPccdw== X-Google-Smtp-Source: ACHHUZ4g4WJm46+AE9ygYDtbYyOXlXuibAn7EhuxGkyzNgH+HB15PMjFtw468OG9KpYlBqtnIu64+A== X-Received: by 2002:a92:c901:0:b0:32c:8b91:befe with SMTP id t1-20020a92c901000000b0032c8b91befemr3520981ilp.12.1682697774763; Fri, 28 Apr 2023 09:02:54 -0700 (PDT) Received: from localhost.localdomain (71-211-191-82.hlrn.qwest.net. [71.211.191.82]) by smtp.gmail.com with ESMTPSA id a17-20020a92d351000000b0032f2f3e5edesm1022997ilh.8.2023.04.28.09.02.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 09:02:54 -0700 (PDT) Date: Fri, 28 Apr 2023 10:02:51 -0600 Subject: [PATCH 1/3] Remove op_name MIME-Version: 1.0 Message-Id: <20230428-minor-expr-cleanuups-v1-1-0a634e8d5c25@adacore.com> References: <20230428-minor-expr-cleanuups-v1-0-0a634e8d5c25@adacore.com> In-Reply-To: <20230428-minor-expr-cleanuups-v1-0-0a634e8d5c25@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" op_name is only needed in a single place, so remove it and inline it there. --- gdb/expprint.c | 41 +++++++++++++++++------------------------ gdb/expression.h | 4 ---- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/gdb/expprint.c b/gdb/expprint.c index e0ec25573c2..b996c9faf8b 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -36,29 +36,6 @@ #include -/* Default name for the standard operator OPCODE (i.e., one defined in - the definition of enum exp_opcode). */ - -const char * -op_name (enum exp_opcode opcode) -{ - switch (opcode) - { - default: - { - static char buf[30]; - - xsnprintf (buf, sizeof (buf), "", opcode); - return buf; - } -#define OP(name) \ - case name: \ - return #name ; -#include "std-operator.def" -#undef OP - } -} - /* Meant to be used in debug sessions, so don't export it in a header file. */ extern void ATTRIBUTE_USED debug_exp (struct expression *exp); @@ -84,7 +61,23 @@ check_objfile (const struct block *block, struct objfile *objfile) void dump_for_expression (struct ui_file *stream, int depth, enum exp_opcode op) { - gdb_printf (stream, _("%*sOperation: %s\n"), depth, "", op_name (op)); + gdb_printf (stream, _("%*sOperation: "), depth, ""); + + switch (op) + { + default: + gdb_printf (stream, "", op); + break; + +#define OP(name) \ + case name: \ + gdb_puts (#name, stream); \ + break; +#include "std-operator.def" +#undef OP + } + + gdb_puts ("\n", stream); } void diff --git a/gdb/expression.h b/gdb/expression.h index c314fc24e1b..77949ddaf4b 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -284,10 +284,6 @@ extern struct value *evaluate_subexp_do_call (expression *exp, const char *function_name, type *default_return_type); -/* From expprint.c */ - -extern const char *op_name (enum exp_opcode opcode); - /* In an OP_RANGE expression, either bound could be empty, indicating that its value is by default that of the corresponding bound of the array or string. Also, the upper end of the range can be exclusive