From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4E8803857C41 for ; Wed, 16 Mar 2022 11:58:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E8803857C41 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-118-fx0iR1HfNLy4cD4d_WmZHw-1; Wed, 16 Mar 2022 07:58:00 -0400 X-MC-Unique: fx0iR1HfNLy4cD4d_WmZHw-1 Received: by mail-wr1-f72.google.com with SMTP id f18-20020adf9f52000000b00203d86759beso488865wrg.11 for ; Wed, 16 Mar 2022 04:58:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=SC/PrRE+5S2qwddqDC6pNiorEZaeKyRLcSFWFFoNAo0=; b=EOqREc2EbTVppRBtUFf8X1cQRFlmHw5B6u0bGIaE1ORBCac1tWTNs9Ca+nxu5v441W W77eex/sblMyJKnisFSkYybLt/4nfsz2EPO9gzIXFEJ3xPNjTHqIEPsDeUpB7vQ7awuJ me6JC1GE2g38MkyC+XPpu6jfQ7VLqFudBiiRhayz0co0/du9wj3KjvYgwCIUNL6ShO2I hk/FJAdYg+BrvxqKATTLVFzWhr6QHl23DJ7RFDnXZHpgUqw3u+vzE+5l1nOTgma+sh1u JXkpCHf313Ky5PjRULPbnODG6B97Y9pHjyVgf78bAlUrSco/oh/U+ndVfKYGMXgJgwsX cAVw== X-Gm-Message-State: AOAM530PWmA3+nX1I2pBm7KXarkNDvQp2FqgztDfLnetSp6Wb/UCL6xY GWMir1G5pLu8dqBAPHJusZjy0fufmmHg61lNg3U6iY4pPSy+Oqeooy5r6rH8WZHOxOXuwUZkd6d Lr3xmY8KaoFZiUH1R0nwmDpS8VP0Vhx6ejgxsAI7meW6DhonIuH6wbqZlYXGXLc/xhmRYgq5AhQ == X-Received: by 2002:a5d:6d8b:0:b0:203:e242:5e38 with SMTP id l11-20020a5d6d8b000000b00203e2425e38mr1195880wrs.105.1647431879308; Wed, 16 Mar 2022 04:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9sF4tggjmZu3IAE70P2DanHyWLgsbsu/da1M5BUIUyi4ZjSVYCZwxcO62tiWm5jTOE/RRPg== X-Received: by 2002:a5d:6d8b:0:b0:203:e242:5e38 with SMTP id l11-20020a5d6d8b000000b00203e2425e38mr1195859wrs.105.1647431878960; Wed, 16 Mar 2022 04:57:58 -0700 (PDT) Received: from localhost (host109-154-72-186.range109-154.btcentralplus.com. [109.154.72.186]) by smtp.gmail.com with ESMTPSA id p4-20020a05600c358400b00389f61bce7csm2394520wmq.32.2022.03.16.04.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 04:57:58 -0700 (PDT) From: Andrew Burgess To: Tom Tromey via Gdb-patches , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH 1/4] Remove eval_op_string In-Reply-To: <20220315132500.1032991-2-tromey@adacore.com> References: <20220315132500.1032991-1-tromey@adacore.com> <20220315132500.1032991-2-tromey@adacore.com> Date: Wed, 16 Mar 2022 11:57:57 +0000 Message-ID: <871qz2un22.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.6 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_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 16 Mar 2022 11:58:03 -0000 Tom Tromey via Gdb-patches writes: > eval_op_string is only used in a single place -- the implementation of > string_operation. This patch turns it into the > string_operation::evaluate method, removing a bit of extraneous code. > --- > gdb/eval.c | 15 ++++++++++----- > gdb/expop.h | 11 +---------- > 2 files changed, 11 insertions(+), 15 deletions(-) LGTM. Thanks, Andrew > > diff --git a/gdb/eval.c b/gdb/eval.c > index 6ced0b261e7..b7b8915fa89 100644 > --- a/gdb/eval.c > +++ b/gdb/eval.c > @@ -1078,17 +1078,22 @@ eval_op_register (struct type *expect_type, struct expression *exp, > return val; > } > > -/* Helper function that implements the body of OP_STRING. */ > +namespace expr > +{ > > -struct value * > -eval_op_string (struct type *expect_type, struct expression *exp, > - enum noside noside, int len, const char *string) > +value * > +string_operation::evaluate (struct type *expect_type, > + struct expression *exp, > + enum noside noside) > { > + const std::string &str = std::get<0> (m_storage); > struct type *type = language_string_char_type (exp->language_defn, > exp->gdbarch); > - return value_string (string, len, type); > + return value_string (str.c_str (), str.size (), type); > } > > +} /* namespace expr */ > + > /* Helper function that implements the body of OP_OBJC_SELECTOR. */ > > struct value * > diff --git a/gdb/expop.h b/gdb/expop.h > index 58863b8f3ab..1592568a857 100644 > --- a/gdb/expop.h > +++ b/gdb/expop.h > @@ -64,10 +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_string (struct type *expect_type, > - struct expression *exp, > - enum noside noside, int len, > - const char *string); > extern struct value *eval_op_ternop (struct type *expect_type, > struct expression *exp, > enum noside noside, > @@ -912,12 +908,7 @@ class string_operation > > value *evaluate (struct type *expect_type, > struct expression *exp, > - enum noside noside) override > - { > - const std::string &str = std::get<0> (m_storage); > - return eval_op_string (expect_type, exp, noside, > - str.size (), str.c_str ()); > - } > + enum noside noside) override; > > enum exp_opcode opcode () const override > { return OP_STRING; } > -- > 2.34.1