From patchwork Wed Mar 6 18:14:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 31746 Received: (qmail 35830 invoked by alias); 6 Mar 2019 18:15:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 34635 invoked by uid 89); 6 Mar 2019 18:15:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=BAYES_00, DNS_FROM_AHBL_RHSBL, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.1 spammy=tracker X-HELO: mail-wr1-f43.google.com Received: from mail-wr1-f43.google.com (HELO mail-wr1-f43.google.com) (209.85.221.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Mar 2019 18:15:27 +0000 Received: by mail-wr1-f43.google.com with SMTP id w17so14496577wrn.12 for ; Wed, 06 Mar 2019 10:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=v3iJAdzx/n25ztFun7gScpmQqoHStH/JqCVg66WxY4E=; b=FB0UaFVH843Ki3D0HbAcu6tcmiFUOfrDhB9q0zr9r7DcqM3FGzXraz4ii8YOb59hfq m3YWoifdeQiENvhu6O4aEH4vYyAetHdD/+mqZF4QLRfjr+NTK7JG2HFDwSGRkGV5tGSN E6C2sKj6lANnUBcdC7iF/vJzEHTPvPoB9v58v+yIk5o+GeULyJnDg5apdWHbwiNpC0o3 N7CLVUr0Abhcd10oUgT3wqBaab2d3AcHwNd4SDqR0sYnBf6HZD5w6zqnZYX56fAuBWDr xlNl+yRjUxs+1FNHtJHRZtqhsx0X8oaMVmvV6wt2AK1TajBcQ/iHFLEATWvjuumSZkdS jpVA== Return-Path: Received: from localhost (host86-142-70-198.range86-142.btcentralplus.com. [86.142.70.198]) by smtp.gmail.com with ESMTPSA id p5sm1698289wme.14.2019.03.06.10.15.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2019 10:15:13 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PUSHED 04/11] gdb/fortran: Add new function to evaluate Fortran expressions Date: Wed, 6 Mar 2019 18:14:57 +0000 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes This is an initial restructure, it adds a new function in which Fortran specific expressions can be evaluated. No Fortran specific expressions are added with this commit though, so for now, the new function just forwards all expressions to the default expression handler, as such, there should be no user visible changes after this commit. However, the new function will be useful in later commits. gdb/ChangeLog: * f-lang.c (evaluate_subexp_f): New function. (exp_descriptor_f): New global. (f_language_defn): Use exp_descriptor_f instead of exp_descriptor_standard. --- gdb/ChangeLog | 7 +++++++ gdb/f-lang.c | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 6eb9b230eb7..5beb46c5f31 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -239,6 +239,15 @@ f_collect_symbol_completion_matches (completion_tracker &tracker, text, word, ":", code); } +/* Special expression evaluation cases for Fortran. */ +struct value * +evaluate_subexp_f (struct type *expect_type, struct expression *exp, + int *pos, enum noside noside) +{ + /* Currently no special handling is required. */ + return evaluate_subexp_standard (expect_type, exp, pos, noside); +} + static const char *f_extensions[] = { ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP", @@ -246,6 +255,17 @@ static const char *f_extensions[] = NULL }; +/* Expression processing for Fortran. */ +static const struct exp_descriptor exp_descriptor_f = +{ + print_subexp_standard, + operator_length_standard, + operator_check_standard, + op_name_standard, + dump_subexp_body_standard, + evaluate_subexp_f +}; + extern const struct language_defn f_language_defn = { "fortran", @@ -256,7 +276,7 @@ extern const struct language_defn f_language_defn = array_column_major, macro_expansion_no, f_extensions, - &exp_descriptor_standard, + &exp_descriptor_f, f_parse, /* parser */ null_post_parser, f_printchar, /* Print character constant */