public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Remove parser_state "initial_size" parameter
@ 2019-04-05  2:02 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-04-05  2:02 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1201a264c8fd227737342345ab54e938295188b6

commit 1201a264c8fd227737342345ab54e938295188b6
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Mar 24 08:40:32 2019 -0600

    Remove parser_state "initial_size" parameter
    
    All the real (not test) uses of parser_state pass 10 as the
    "initial_size" parameter, and it seems to me that there's no real
    reason to require callers to set this.  This patch removes this
    parameter.
    
    gdb/ChangeLog
    2019-04-04  Tom Tromey  <tom@tromey.com>
    
    	* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
    	* stap-probe.c (stap_parse_argument): Update.
    	* stap-probe.h (struct stap_parse_info) <stap_parse_info>: Remove
    	initial_size parameter.
    	* rust-exp.y (rust_lex_tests): Update.
    	* parse.c (parser_state): Update.
    	(parse_exp_in_context): Update.
    	* parser-defs.h (struct parser_state) <parser_state>: Remove
    	"initial_size" parameter.

Diff:
---
 gdb/ChangeLog      | 12 ++++++++++++
 gdb/dtrace-probe.c |  2 +-
 gdb/parse.c        |  7 +++----
 gdb/parser-defs.h  |  7 +++----
 gdb/rust-exp.y     |  2 +-
 gdb/stap-probe.c   |  2 +-
 gdb/stap-probe.h   |  4 ++--
 7 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 36a8e24..ae7c5df 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,17 @@
 2019-04-04  Tom Tromey  <tom@tromey.com>
 
+	* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
+	* stap-probe.c (stap_parse_argument): Update.
+	* stap-probe.h (struct stap_parse_info) <stap_parse_info>: Remove
+	initial_size parameter.
+	* rust-exp.y (rust_lex_tests): Update.
+	* parse.c (parser_state): Update.
+	(parse_exp_in_context): Update.
+	* parser-defs.h (struct parser_state) <parser_state>: Remove
+	"initial_size" parameter.
+
+2019-04-04  Tom Tromey  <tom@tromey.com>
+
 	* parser-defs.h (increase_expout_size): Don't declare.
 	* parse.c (increase_expout_size): Now static.
 
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 527e0f0..f80db71 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -627,7 +627,7 @@ dtrace_probe::build_arg_exprs (struct gdbarch *gdbarch)
       /* Initialize the expression buffer in the parser state.  The
 	 language does not matter, since we are using our own
 	 parser.  */
-      parser_state pstate (10, current_language, gdbarch);
+      parser_state pstate (current_language, gdbarch);
 
       /* The argument value, which is ABI dependent and casted to
 	 `long int'.  */
diff --git a/gdb/parse.c b/gdb/parse.c
index 6716597..69c63da 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -165,10 +165,9 @@ end_arglist (void)
 
 /* See definition in parser-defs.h.  */
 
-parser_state::parser_state (size_t initial_size,
-			    const struct language_defn *lang,
+parser_state::parser_state (const struct language_defn *lang,
 			    struct gdbarch *gdbarch)
-  : expout_size (initial_size),
+  : expout_size (10),
     expout (XNEWVAR (expression,
 		     (sizeof (expression)
 		      + EXP_ELEM_TO_BYTES (expout_size)))),
@@ -1190,7 +1189,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
      and others called from *.y) ensure CURRENT_LANGUAGE gets restored
      to the value matching SELECTED_FRAME as set by get_current_arch.  */
 
-  parser_state ps (10, lang, get_current_arch ());
+  parser_state ps (lang, get_current_arch ());
 
   scoped_restore_current_language lang_saver;
   set_language (lang->la_language);
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index bb0d52b..ffdbd83 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -37,11 +37,10 @@ extern int parser_debug;
 
 struct parser_state
 {
-  /* Constructor.  INITIAL_SIZE is the initial size of the expout
-     array.  LANG is the language used to parse the expression.  And
-     GDBARCH is the gdbarch to use during parsing.  */
+  /* Constructor.  LANG is the language used to parse the expression.
+     And GDBARCH is the gdbarch to use during parsing.  */
 
-  parser_state (size_t initial_size, const struct language_defn *lang,
+  parser_state (const struct language_defn *lang,
 		struct gdbarch *gdbarch);
 
   DISABLE_COPY_AND_ASSIGN (parser_state);
diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index 9b9735a..1379030 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -2707,7 +2707,7 @@ rust_lex_tests (void)
   int i;
 
   // Set up dummy "parser", so that rust_type works.
-  struct parser_state ps (0, &rust_language_defn, target_gdbarch ());
+  struct parser_state ps (&rust_language_defn, target_gdbarch ());
   rust_parser parser (&ps);
 
   rust_lex_test_one (&parser, "", 0);
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index a53c04d..24b2b78 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -1149,7 +1149,7 @@ stap_parse_argument (const char **arg, struct type *atype,
   /* We need to initialize the expression buffer, in order to begin
      our parsing efforts.  We use language_c here because we may need
      to do pointer arithmetics.  */
-  struct stap_parse_info p (*arg, atype, 10, language_def (language_c),
+  struct stap_parse_info p (*arg, atype, language_def (language_c),
 			    gdbarch);
 
   stap_parse_argument_1 (&p, 0, STAP_OPERAND_PREC_NONE);
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index 2a3a6d4..6c56904 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -29,10 +29,10 @@
 struct stap_parse_info
 {
   stap_parse_info (const char *arg_, struct type *arg_type_,
-		   size_t initial_size, const struct language_defn *lang,
+		   const struct language_defn *lang,
 		   struct gdbarch *gdbarch)
     : arg (arg_),
-      pstate (initial_size, lang, gdbarch),
+      pstate (lang, gdbarch),
       saved_arg (arg_),
       arg_type (arg_type_),
       gdbarch (gdbarch),


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-05  2:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-05  2:02 [binutils-gdb] Remove parser_state "initial_size" parameter Tom Tromey

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).