From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-32f397b44dcso18387725ab.1 for ; Fri, 28 Apr 2023 09:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1682697775; x=1685289775; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=P+Pn96p+jSBxz9AE7mCHOGBhhPLgPJrTeF79fuGPc/4=; b=dYr9i97AvxnNE/OoMNW1tO4Yqn729RnG5L4bZ/jCp87U1KN31svx1hjHP3oWVJ/hA0 ubfcKgj5rJ2MH67aUqsC6lnUVFSH1wau0rhngDSfEQZC204SGZ9pRe1lJYQoTb7RJHgt Jji/iZsbXRRlfRA/x84VTjB2zrhYROqbxowFLcTCmk70HSijFguJh/3nxLoh/gLFobJF WXbagXaa2QmEl4qfezXPdC0tzHp/86G92NsRnasEnDhioTV+lgaPLG3MoBZunBuxpcvk WQPD6BJkA4KdTGqOoSWWOm8qZBmR/VEc5nxmn0V3D6fVB9ydwsW9vA03zl3gDHp0PvuU gP3Q== 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) From: Tom Tromey Date: Fri, 28 Apr 2023 10:02:51 -0600 Subject: [PATCH 1/3] Remove op_name MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 List-Id: 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 -- 2.39.1