public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] gdb: Convert language la_post_parser field to a method
Date: Tue, 23 Jun 2020 11:34:27 -0400	[thread overview]
Message-ID: <1bf9c36374d9c758bc49dc18dca7acf0719e290d@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 1bf9c36374d9c758bc49dc18dca7acf0719e290d ***

commit 1bf9c36374d9c758bc49dc18dca7acf0719e290d
Author:     Andrew Burgess <andrew.burgess@embecosm.com>
AuthorDate: Tue Jun 2 14:57:40 2020 +0100
Commit:     Andrew Burgess <andrew.burgess@embecosm.com>
CommitDate: Tue Jun 23 13:34:11 2020 +0100

    gdb: Convert language la_post_parser field to a method
    
    This commit changes the language_data::la_post_parser function pointer
    member variable into a member function of language_defn.
    
    There should be no user visible changes after this commit.
    
    gdb/ChangeLog:
    
            * ada-lang.c (resolve): Rename to ada_language::post_parser.
            (ada_language_data): Delete la_post_parser initializer.
            (ada_language::post_parser): New member function.
            * c-lang.c (c_language_data): Delete la_post_parser initializer.
            (cplus_language_data): Likewise.
            (asm_language_data): Likewise.
            (minimal_language_data): Likewise.
            * d-lang.c (d_language_data): Likewise.
            * f-lang.c (f_language_data): Likewise.
            * go-lang.c (go_language_data): Likewise.
            * language.c (unknown_language_data): Likewise.
            (auto_language_data): Likewise.
            * language.h (language_data): Delete la_post_parser field.
            (language_defn::post_parser): New member function.
            * m2-lang.c (m2_language_data): Delete la_post_parser initializer.
            * objc-lang.c (objc_language_data): Likewise.
            * opencl-lang.c (opencl_language_data): Likewise.
            * p-lang.c (pascal_language_data): Likewise.
            * parse.c (parse_exp_in_context): Update call to post_parser.
            (null_post_parser): Delete definition.
            * parser-defs.h (null_post_parser): Delete declaration.
            * rust-lang.c (rust_language_data): Delete la_post_parser
            initializer.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a0e120d676..098014a429 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,29 @@
+2020-06-23  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* ada-lang.c (resolve): Rename to ada_language::post_parser.
+	(ada_language_data): Delete la_post_parser initializer.
+	(ada_language::post_parser): New member function.
+	* c-lang.c (c_language_data): Delete la_post_parser initializer.
+	(cplus_language_data): Likewise.
+	(asm_language_data): Likewise.
+	(minimal_language_data): Likewise.
+	* d-lang.c (d_language_data): Likewise.
+	* f-lang.c (f_language_data): Likewise.
+	* go-lang.c (go_language_data): Likewise.
+	* language.c (unknown_language_data): Likewise.
+	(auto_language_data): Likewise.
+	* language.h (language_data): Delete la_post_parser field.
+	(language_defn::post_parser): New member function.
+	* m2-lang.c (m2_language_data): Delete la_post_parser initializer.
+	* objc-lang.c (objc_language_data): Likewise.
+	* opencl-lang.c (opencl_language_data): Likewise.
+	* p-lang.c (pascal_language_data): Likewise.
+	* parse.c (parse_exp_in_context): Update call to post_parser.
+	(null_post_parser): Delete definition.
+	* parser-defs.h (null_post_parser): Delete declaration.
+	* rust-lang.c (rust_language_data): Delete la_post_parser
+	initializer.
+
 2020-06-23  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* ada-lang.c (parse): Rename to ada_language::parser.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c4ee79eb8d..bb6d011e13 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3360,28 +3360,6 @@ See set/show multiple-symbol."));
   return n_chosen;
 }
 
-/* Same as evaluate_type (*EXP), but resolves ambiguous symbol
-   references (marked by OP_VAR_VALUE nodes in which the symbol has an
-   undefined namespace) and converts operators that are
-   user-defined into appropriate function calls.  If CONTEXT_TYPE is
-   non-null, it provides a preferred result type [at the moment, only
-   type void has any effect---causing procedures to be preferred over
-   functions in calls].  A null CONTEXT_TYPE indicates that a non-void
-   return type is preferred.  May change (expand) *EXP.  */
-
-static void
-resolve (expression_up *expp, int void_context_p, int parse_completion,
-	 innermost_block_tracker *tracker)
-{
-  struct type *context_type = NULL;
-  int pc = 0;
-
-  if (void_context_p)
-    context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
-
-  resolve_subexp (expp, &pc, 1, context_type, parse_completion, tracker);
-}
-
 /* Resolve the operator of the subexpression beginning at
    position *POS of *EXPP.  "Resolving" consists of replacing
    the symbols that have undefined namespaces in OP_VAR_VALUE nodes
@@ -13711,7 +13689,6 @@ extern const struct language_data ada_language_data =
   macro_expansion_no,
   ada_extensions,
   &ada_exp_descriptor,
-  resolve,
   ada_printchar,                /* Print a character constant */
   ada_printstr,                 /* Function to print string constant */
   emit_char,                    /* Function to print single char (not used) */
@@ -14116,6 +14093,29 @@ public:
     return ada_parse (ps);
   }
 
+  /* See language.h.
+
+     Same as evaluate_type (*EXP), but resolves ambiguous symbol references
+     (marked by OP_VAR_VALUE nodes in which the symbol has an undefined
+     namespace) and converts operators that are user-defined into
+     appropriate function calls.  If CONTEXT_TYPE is non-null, it provides
+     a preferred result type [at the moment, only type void has any
+     effect---causing procedures to be preferred over functions in calls].
+     A null CONTEXT_TYPE indicates that a non-void return type is
+     preferred.  May change (expand) *EXP.  */
+
+  void post_parser (expression_up *expp, int void_context_p, int completing,
+		    innermost_block_tracker *tracker) const override
+  {
+    struct type *context_type = NULL;
+    int pc = 0;
+
+    if (void_context_p)
+      context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
+
+    resolve_subexp (expp, &pc, 1, context_type, completing, tracker);
+  }
+
 protected:
   /* See language.h.  */
 
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 37e69d433f..363c896b7a 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -889,7 +889,6 @@ extern const struct language_data c_language_data =
   macro_expansion_c,
   c_extensions,
   &exp_descriptor_c,
-  null_post_parser,
   c_printchar,			/* Print a character constant */
   c_printstr,			/* Function to print string constant */
   c_emit_char,			/* Print a single char */
@@ -996,7 +995,6 @@ extern const struct language_data cplus_language_data =
   macro_expansion_c,
   cplus_extensions,
   &exp_descriptor_c,
-  null_post_parser,
   c_printchar,			/* Print a character constant */
   c_printstr,			/* Function to print string constant */
   c_emit_char,			/* Print a single char */
@@ -1200,7 +1198,6 @@ extern const struct language_data asm_language_data =
   macro_expansion_c,
   asm_extensions,
   &exp_descriptor_c,
-  null_post_parser,
   c_printchar,			/* Print a character constant */
   c_printstr,			/* Function to print string constant */
   c_emit_char,			/* Print a single char */
@@ -1262,7 +1259,6 @@ extern const struct language_data minimal_language_data =
   macro_expansion_c,
   NULL,
   &exp_descriptor_c,
-  null_post_parser,
   c_printchar,			/* Print a character constant */
   c_printstr,			/* Function to print string constant */
   c_emit_char,			/* Print a single char */
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index e2765b5671..facc82c201 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -142,7 +142,6 @@ extern const struct language_data d_language_data =
   macro_expansion_no,
   d_extensions,
   &exp_descriptor_c,
-  null_post_parser,
   c_printchar,			/* Print a character constant.  */
   c_printstr,			/* Function to print string constant.  */
   c_emit_char,			/* Print a single char.  */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 918a8cfd3d..1b545b27b3 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -564,7 +564,6 @@ extern const struct language_data f_language_data =
   macro_expansion_no,
   f_extensions,
   &exp_descriptor_f,
-  null_post_parser,
   f_printchar,			/* Print character constant */
   f_printstr,			/* function to print string constant */
   f_emit_char,			/* Function to print a single character */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index f2553bb399..c26dee9a06 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -527,7 +527,6 @@ extern const struct language_data go_language_data =
   macro_expansion_no,
   NULL,
   &exp_descriptor_c,
-  null_post_parser,
   c_printchar,			/* Print a character constant.  */
   c_printstr,			/* Function to print string constant.  */
   c_emit_char,			/* Print a single char.  */
diff --git a/gdb/language.c b/gdb/language.c
index 828d21dc7e..72fa1e4513 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -777,7 +777,6 @@ extern const struct language_data unknown_language_data =
   macro_expansion_no,
   NULL,
   &exp_descriptor_standard,
-  null_post_parser,
   unk_lang_printchar,		/* Print character constant */
   unk_lang_printstr,
   unk_lang_emit_char,
@@ -868,7 +867,6 @@ extern const struct language_data auto_language_data =
   macro_expansion_no,
   NULL,
   &exp_descriptor_standard,
-  null_post_parser,
   unk_lang_printchar,		/* Print character constant */
   unk_lang_printstr,
   unk_lang_emit_char,
diff --git a/gdb/language.h b/gdb/language.h
index 7434d74523..d5b106d84e 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -225,17 +225,6 @@ struct language_data
 
     const struct exp_descriptor *la_exp_desc;
 
-    /* Given an expression *EXPP created by prefixifying the result of
-       la_parser, perform any remaining processing necessary to complete
-       its translation.  *EXPP may change; la_post_parser is responsible 
-       for releasing its previous contents, if necessary.  If 
-       VOID_CONTEXT_P, then no value is expected from the expression.
-       If COMPLETING is non-zero, then the expression has been parsed
-       for completion, not evaluation.  */
-
-    void (*la_post_parser) (expression_up *expp, int void_context_p,
-			    int completing, innermost_block_tracker *tracker);
-
     void (*la_printchar) (int ch, struct type *chtype,
 			  struct ui_file * stream);
 
@@ -540,6 +529,21 @@ struct language_defn : language_data
 
   virtual int parser (struct parser_state *ps) const;
 
+  /* Given an expression *EXPP created by prefixifying the result of
+     la_parser, perform any remaining processing necessary to complete its
+     translation.  *EXPP may change; la_post_parser is responsible for
+     releasing its previous contents, if necessary.  If VOID_CONTEXT_P,
+     then no value is expected from the expression.  If COMPLETING is
+     non-zero, then the expression has been parsed for completion, not
+     evaluation.  */
+
+  virtual void post_parser (expression_up *expp, int void_context_p,
+			    int completing,
+			    innermost_block_tracker *tracker) const
+  {
+    /* By default the post-parser does nothing.  */
+  }
+
 protected:
 
   /* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 189f513605..5aca833496 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -362,7 +362,6 @@ extern const struct language_data m2_language_data =
   macro_expansion_no,
   NULL,
   &exp_descriptor_modula2,
-  null_post_parser,
   m2_printchar,			/* Print character constant */
   m2_printstr,			/* function to print string constant */
   m2_emit_char,			/* Function to print a single character */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 90804acc16..2ec87774f4 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -337,7 +337,6 @@ extern const struct language_data objc_language_data =
   macro_expansion_c,
   objc_extensions,
   &exp_descriptor_standard,
-  null_post_parser,
   c_printchar,		       /* Print a character constant */
   c_printstr,		       /* Function to print string constant */
   c_emit_char,
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 7c9965814f..f314eff55f 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1016,7 +1016,6 @@ extern const struct language_data opencl_language_data =
   macro_expansion_c,
   NULL,
   &exp_descriptor_opencl,
-  null_post_parser,
   c_printchar,			/* Print a character constant */
   c_printstr,			/* Function to print string constant */
   c_emit_char,			/* Print a single char */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index ce812d1d30..14ca5d7833 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -393,7 +393,6 @@ extern const struct language_data pascal_language_data =
   macro_expansion_no,
   p_extensions,
   &exp_descriptor_standard,
-  null_post_parser,
   pascal_printchar,		/* Print a character constant */
   pascal_printstr,		/* Function to print string constant */
   pascal_emit_char,		/* Print a single char */
diff --git a/gdb/parse.c b/gdb/parse.c
index f003a30baf..2fb474e27f 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1146,8 +1146,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
   if (out_subexp)
     *out_subexp = subexp;
 
-  lang->la_post_parser (&result, void_context_p, ps.parse_completion,
-			tracker);
+  lang->post_parser (&result, void_context_p, ps.parse_completion, tracker);
 
   if (expressiondebug)
     dump_prefix_expression (result.get (), gdb_stdlog);
@@ -1241,14 +1240,6 @@ parse_expression_for_completion (const char *string,
   return value_type (val);
 }
 
-/* A post-parser that does nothing.  */
-
-void
-null_post_parser (expression_up *exp, int void_context_p, int completin,
-		  innermost_block_tracker *tracker)
-{
-}
-
 /* Parse floating point value P of length LEN.
    Return false if invalid, true if valid.
    The successfully parsed number is stored in DATA in
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index d6c3b06897..a9b8a12959 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -350,9 +350,6 @@ extern int operator_check_standard (struct expression *exp, int pos,
 
 extern const char *op_name_standard (enum exp_opcode);
 
-extern void null_post_parser (expression_up *, int, int,
-			      innermost_block_tracker *);
-
 extern bool parse_float (const char *p, int len,
 			 const struct type *type, gdb_byte *data);
 \f
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 2153323cff..846fe1fa40 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1989,7 +1989,6 @@ extern const struct language_data rust_language_data =
   macro_expansion_no,
   rust_extensions,
   &exp_descriptor_rust,
-  null_post_parser,
   rust_printchar,		/* Print a character constant */
   rust_printstr,		/* Function to print string constant */
   rust_emitchar,		/* Print a single char */


             reply	other threads:[~2020-06-23 15:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 15:34 gdb-buildbot [this message]
2020-06-23 15:34 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, branch master gdb-buildbot
2020-07-23 17:19 ` *** COMPILATION FAILED *** Failures on Fedora-i686, branch master *** BREAKAGE *** gdb-buildbot
2020-07-23 17:57 ` Failures on Fedora-x86_64-cc-with-index, branch master gdb-buildbot
2020-07-23 17:59 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-07-23 18:31 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-07-23 18:44 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-07-23 19:17 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-07-23 19:19 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-07-23 19:56 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bf9c36374d9c758bc49dc18dca7acf0719e290d@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).