From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OHieORsj7mQ0sQ0AWB0awg (envelope-from ) for ; Tue, 29 Aug 2023 12:55:55 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=N9DiwbjY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DED3E1E0C2; Tue, 29 Aug 2023 12:55:55 -0400 (EDT) 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 (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CBFE01E092 for ; Tue, 29 Aug 2023 12:55:53 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D85A385841D for ; Tue, 29 Aug 2023 16:55:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D85A385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693328153; bh=VpxFBlWaUc5wUjaHwSXmFnmHMEiEvEVVdOJ4zMRqSvA=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=N9DiwbjYmG8J1XD+n03yr6a9heO5/JfX6xXxK7tMt1yKk/8Eprj/EtFy2O+kYqdUk 4bDDAtmCisrqawf3tEHumRuYtVoMEArypNvA0O+gFf8PmVTsJVBn+AjVI0KTXq9/h8 i+Y9Vd2j8b3s2fhfZ3V4MzeF1+5WaHmE1O2Sr750= Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 31BDA3858D28 for ; Tue, 29 Aug 2023 16:55:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31BDA3858D28 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-34cb979c9b9so16208475ab.1 for ; Tue, 29 Aug 2023 09:55:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693328131; x=1693932931; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VpxFBlWaUc5wUjaHwSXmFnmHMEiEvEVVdOJ4zMRqSvA=; b=a8/3VWdhxs3rJvLlgJL2+n9IHA0SuN7mATP4iC+3gcbMvVuoHoKig36f6aPRjSmltg unK/YC4NJ2A56UNsrefhxIpiU0K/BFkfPgejbjyvsTSt4v41mPQS1CodxMcNdfqTVDcU 1kFvlBSBCzMck9X721n1hCykHHn3jMVvjmFe5Y2ivoFxdnkUze7jg1HkgmnfpE57g/Cr BwbIOCEQqKe01ZphyXNuxkErWhXzvQeE52asrU6Em3JQ6ZKy9z0mJ0wlLdRpVy/HaYOl yKZsKaE4c6WInPZnN+mezMZjYlQwrXSsI3Z60yTKsHKcdyne79+/TMGUGJmcD/k728fo 760Q== X-Gm-Message-State: AOJu0YwZQzwUX+mAHmvsR8NzGzvt0vKjQZAmGBiGNG7ecuhEeSGdbXnj Xc/lUrpaVuNZZpVTu1MS7RXgEwLMCH32kNAeq9eJ+Q== X-Google-Smtp-Source: AGHT+IFl2eY3PEQU26427gDfSjPFiTVn7eYHEGWPKQ8J49wPozif2kOGxT36FR3SJKu/vrwu3lZ+pg== X-Received: by 2002:a05:6e02:1c08:b0:34d:e998:fb4f with SMTP id l8-20020a056e021c0800b0034de998fb4fmr3884786ilh.10.1693328131501; Tue, 29 Aug 2023 09:55:31 -0700 (PDT) Received: from localhost.localdomain (75-166-150-212.hlrn.qwest.net. [75.166.150.212]) by smtp.gmail.com with ESMTPSA id z8-20020a92d6c8000000b003497ced3fa1sm3213909ilp.29.2023.08.29.09.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 09:55:31 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove eval_op_ternop Date: Tue, 29 Aug 2023 10:55:22 -0600 Message-Id: <20230829165522.2732215-1-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.7 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 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom Tromey via Gdb-patches Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" eval_op_ternop is only used by the implementation of ternop_slice_operation. While working on another series, it was convenient for me to merge this function into its only caller. --- gdb/eval.c | 29 +++++++++++++++++------------ gdb/expop.h | 16 +--------------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/gdb/eval.c b/gdb/eval.c index 457a6697923..228862e22d0 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1155,6 +1155,23 @@ string_operation::evaluate (struct type *expect_type, return value_string (str.c_str (), str.size (), type); } +struct value * +ternop_slice_operation::evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) +{ + struct value *array + = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); + struct value *low + = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); + struct value *upper + = std::get<2> (m_storage)->evaluate (nullptr, exp, noside); + + int lowbound = value_as_long (low); + int upperbound = value_as_long (upper); + return value_slice (array, lowbound, upperbound - lowbound + 1); +} + } /* namespace expr */ /* Helper function that implements the body of OP_OBJC_SELECTOR. */ @@ -1169,18 +1186,6 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp, lookup_child_selector (exp->gdbarch, sel)); } -/* A helper function for TERNOP_SLICE. */ - -struct value * -eval_op_ternop (struct type *expect_type, struct expression *exp, - enum noside noside, - struct value *array, struct value *low, struct value *upper) -{ - int lowbound = value_as_long (low); - int upperbound = value_as_long (upper); - return value_slice (array, lowbound, upperbound - lowbound + 1); -} - /* A helper function for STRUCTOP_STRUCT. */ struct value * diff --git a/gdb/expop.h b/gdb/expop.h index a9da11cc70d..25769d5b810 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -64,11 +64,6 @@ extern struct value *eval_op_func_static_var (struct type *expect_type, extern struct value *eval_op_register (struct type *expect_type, struct expression *exp, enum noside noside, const char *name); -extern struct value *eval_op_ternop (struct type *expect_type, - struct expression *exp, - enum noside noside, - struct value *array, struct value *low, - struct value *upper); extern struct value *eval_op_structop_struct (struct type *expect_type, struct expression *exp, enum noside noside, @@ -939,16 +934,7 @@ class ternop_slice_operation value *evaluate (struct type *expect_type, struct expression *exp, - enum noside noside) override - { - struct value *array - = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); - struct value *low - = std::get<1> (m_storage)->evaluate (nullptr, exp, noside); - struct value *upper - = std::get<2> (m_storage)->evaluate (nullptr, exp, noside); - return eval_op_ternop (expect_type, exp, noside, array, low, upper); - } + enum noside noside) override; enum exp_opcode opcode () const override { return TERNOP_SLICE; } -- 2.40.1