From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 48D7538708BD for ; Mon, 4 Jan 2021 12:06:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48D7538708BD Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x435.google.com with SMTP id w5so31887076wrm.11 for ; Mon, 04 Jan 2021 04:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ko/23oHuPT0xSm+24OXmek4heciMEoDSwgfepqxPxuI=; b=hIrfBBP8tZFmUNuHPMQUY9d7LM6e8+Q6hsu6EqyT/5tSKOBuma1JNS3sGmqqS5abUt aabIPDadu3M6v84k/4+O5b8hrDYaM3iG1J8nmQsH0I4UjGSTdWdCdeJBpjH1jinpsXII hfkmeDcZjUpNInI+1LBlS/yAwsWDclDWn/Uu2k0vWTBnBjwVSeDYiCPpPuani14dEBxN qzhtrqSYDfSfzuqR70pig+MPPiausl7Ah6WHF7KsvKIjVpg55dcnaZd1YnUBBG4PdZBu xguEI9oK502Iq3nNxsMOxOStXT5KlCt9FawV/1SlXSZjjyORctCUfgP3dEBBS83yzR9q spoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ko/23oHuPT0xSm+24OXmek4heciMEoDSwgfepqxPxuI=; b=XyeqoXxCXHmRqvYz/s2AOKFNn7xt5t+SvlXnXHOUll9GWzgQrV7+p1YpGP4DmrgUy3 Gib5aEVRWUEDyryxbldGviMmDoTqAFRKr79q+Dkt5YfuYpz7X7yFSxv1jA3Mop1fDI1m SXfBVWFxVMGuTYO2o1Xz+WOhihmh7p1dRXO3SVICqHEjzRZdLGAacAla3OBSTMzEurHE PeLMJoVgClaUL9YG6tsN3az4St6+gsBaNHYYbd7YUBzxZLVs/fBRh6X+HvOE4GwgeDKo x6UCrQVZdAcPIhDR6N8nZf//Cq36ea3QDoikYOEyRkap3DUK9s0ozZ3JLvAJxhDnqqgf IvBA== X-Gm-Message-State: AOAM533UBGwH8dmAhoa0O2WF3zjQPdTGFijyFdHsYa4tJXBAzdiIpils pG5lIYRozLWqV+xzURk6aJ40VlhRXLTgiw== X-Google-Smtp-Source: ABdhPJwyVHLfZ1eijoh/2DzLlnAoB9uzyXnfTufF+avGTujYCu3yCcJhkwRpU51KyePVKrsWH1IBSw== X-Received: by 2002:a5d:6845:: with SMTP id o5mr78837344wrw.421.1609761961448; Mon, 04 Jan 2021 04:06:01 -0800 (PST) Received: from localhost (host86-188-49-102.range86-188.btcentralplus.com. [86.188.49.102]) by smtp.gmail.com with ESMTPSA id w18sm95955679wrn.2.2021.01.04.04.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 04:06:00 -0800 (PST) Date: Mon, 4 Jan 2021 12:05:59 +0000 From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 052/203] Split out eval_op_m2_high Message-ID: <20210104120559.GX2945@embecosm.com> References: <20210101214723.1784144-1-tom@tromey.com> <20210101214723.1784144-53-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210101214723.1784144-53-tom@tromey.com> X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 12:04:29 up 26 days, 16:48, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-11.9 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 04 Jan 2021 12:06:05 -0000 * Tom Tromey [2021-01-01 14:44:52 -0700]: > This splits UNOP_HIGH into a new function for future use. > > gdb/ChangeLog > 2021-01-01 Tom Tromey > > * m2-lang.c (eval_op_m2_high): New function. > (evaluate_subexp_modula2): Use it. > --- > gdb/ChangeLog | 5 +++++ > gdb/m2-lang.c | 55 ++++++++++++++++++++++++++++++--------------------- > 2 files changed, 37 insertions(+), 23 deletions(-) > > diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c > index fb49ba470d6..982bc264a3b 100644 > --- a/gdb/m2-lang.c > +++ b/gdb/m2-lang.c > @@ -29,6 +29,37 @@ > #include "valprint.h" > #include "gdbarch.h" > > +/* A helper function for UNOP_HIGH. */ > + > +static struct value * > +eval_op_m2_high (struct type *expect_type, struct expression *exp, > + enum noside noside, > + struct value *arg1) > +{ > + if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) > + return arg1; > + else > + { > + arg1 = coerce_ref (arg1); > + struct type *type = check_typedef (value_type (arg1)); > + > + if (m2_is_unbounded_array (type)) > + { > + struct value *temp = arg1; > + > + type = type->field (1).type (); > + /* i18n: Do not translate the "_m2_high" part! */ > + arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL, > + _("unbounded structure " > + "missing _m2_high field")); > + Not your mistake (copied code), but there's an unneeded tab at the end of the previous otherwise empty line. Maybe you could clean this up? Thanks, Andrew > + if (value_type (arg1) != type) > + arg1 = value_cast (type, arg1); > + } > + } > + return arg1; > +} > + > static struct value * > evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, > int *pos, enum noside noside) > @@ -43,29 +74,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, > case UNOP_HIGH: > (*pos)++; > arg1 = evaluate_subexp_with_coercion (exp, pos, noside); > - > - if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) > - return arg1; > - else > - { > - arg1 = coerce_ref (arg1); > - type = check_typedef (value_type (arg1)); > - > - if (m2_is_unbounded_array (type)) > - { > - struct value *temp = arg1; > - > - type = type->field (1).type (); > - /* i18n: Do not translate the "_m2_high" part! */ > - arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL, > - _("unbounded structure " > - "missing _m2_high field")); > - > - if (value_type (arg1) != type) > - arg1 = value_cast (type, arg1); > - } > - } > - return arg1; > + return eval_op_m2_high (expect_type, exp, noside, arg1); > > case BINOP_SUBSCRIPT: > (*pos)++; > -- > 2.26.2 >