aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-13 10:37:13 -0600
committerTom Tromey <tom@tromey.com>2017-09-06 15:49:30 -0600
commiteae49211e13efa075d57ab354ea4207666eadc96 (patch)
tree6cbf8e62f73a076d795c0fb3aacd84487037cd9a
parent73b9be8b5301c4ac056e10c38a47414867ee892a (diff)
downloadfsf-binutils-gdb-eae49211e13efa075d57ab354ea4207666eadc96.zip
fsf-binutils-gdb-eae49211e13efa075d57ab354ea4207666eadc96.tar.gz
fsf-binutils-gdb-eae49211e13efa075d57ab354ea4207666eadc96.tar.bz2
Remove make_cleanup_clear_parser_state
This removes make_cleanup_clear_parser_state in favor of scoped_restore. 2017-09-05 Tom Tromey <tom@tromey.com> * utils.c (do_clear_parser_state): Remove. (make_cleanup_clear_parser_state): Remove. * p-exp.y (pascal_parse): Use scoped_restore. * m2-exp.y (m2_parse): Use scoped_restore. * f-exp.y (f_parse): Use scoped_restore. * d-exp.y (d_parse): Use scoped_restore. * c-exp.y (c_parse): Use scoped_restore. * ada-exp.y (ada_parse): Use scoped_restore. * utils.h (make_cleanup_clear_parser_state): Remove.
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/ada-exp.y8
-rw-r--r--gdb/c-exp.y2
-rw-r--r--gdb/d-exp.y2
-rw-r--r--gdb/f-exp.y8
-rw-r--r--gdb/go-exp.y2
-rw-r--r--gdb/m2-exp.y9
-rw-r--r--gdb/p-exp.y8
-rw-r--r--gdb/utils.c18
-rw-r--r--gdb/utils.h4
10 files changed, 23 insertions, 50 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8080a55..f361023 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2017-09-05 Tom Tromey <tom@tromey.com>
+
+ * utils.c (do_clear_parser_state): Remove.
+ (make_cleanup_clear_parser_state): Remove.
+ * p-exp.y (pascal_parse): Use scoped_restore.
+ * m2-exp.y (m2_parse): Use scoped_restore.
+ * f-exp.y (f_parse): Use scoped_restore.
+ * d-exp.y (d_parse): Use scoped_restore.
+ * c-exp.y (c_parse): Use scoped_restore.
+ * ada-exp.y (ada_parse): Use scoped_restore.
+ * utils.h (make_cleanup_clear_parser_state): Remove.
+
2017-09-06 Keith Seitz <keiths@redhat.com>
* dwarf2read.c (dw2_linkage_name_attr): New function.
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 1eea454..618c9d5 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -733,10 +733,8 @@ static struct obstack temp_parse_space;
int
ada_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
@@ -745,9 +743,7 @@ ada_parse (struct parser_state *par_state)
obstack_free (&temp_parse_space, NULL);
obstack_init (&temp_parse_space);
- result = yyparse ();
- do_cleanups (c);
- return result;
+ return yyparse ();
}
void
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index bcc3e12..43af80c 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -3232,6 +3232,7 @@ c_parse (struct parser_state *par_state)
struct cleanup *back_to;
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
@@ -3239,7 +3240,6 @@ c_parse (struct parser_state *par_state)
assuming they'll be run here (below). */
back_to = make_cleanup (free_current_contents, &expression_macro_scope);
- make_cleanup_clear_parser_state (&pstate);
/* Set up the scope for macro expansion. */
expression_macro_scope = NULL;
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index d392a5c..9b773c6 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -1624,6 +1624,7 @@ d_parse (struct parser_state *par_state)
struct cleanup *back_to;
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
@@ -1633,7 +1634,6 @@ d_parse (struct parser_state *par_state)
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
parser_debug);
- make_cleanup_clear_parser_state (&pstate);
/* Initialize some state used by the lexer. */
last_was_structop = 0;
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 7e9e234..8dcc811 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1206,16 +1206,12 @@ yylex (void)
int
f_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
- result = yyparse ();
- do_cleanups (c);
- return result;
+ return yyparse ();
}
void
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index f2f3596..098e734 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -1564,6 +1564,7 @@ go_parse (struct parser_state *par_state)
struct cleanup *back_to;
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
@@ -1573,7 +1574,6 @@ go_parse (struct parser_state *par_state)
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
parser_debug);
- make_cleanup_clear_parser_state (&pstate);
/* Initialize some state used by the lexer. */
last_was_structop = 0;
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 9179187..02dc36f 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -1036,17 +1036,12 @@ yylex (void)
int
m2_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
- result = yyparse ();
- do_cleanups (c);
-
- return result;
+ return yyparse ();
}
void
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 81eb216..eee4fa9 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1701,16 +1701,12 @@ yylex (void)
int
pascal_parse (struct parser_state *par_state)
{
- int result;
- struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
/* Setting up the parser state. */
+ scoped_restore pstate_restore = make_scoped_restore (&pstate);
gdb_assert (par_state != NULL);
pstate = par_state;
- result = yyparse ();
- do_cleanups (c);
- return result;
+ return yyparse ();
}
void
diff --git a/gdb/utils.c b/gdb/utils.c
index af50cf0..f2da2df 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -257,24 +257,6 @@ make_cleanup_value_free (struct value *value)
return make_cleanup (do_value_free, value);
}
-/* Helper function for make_cleanup_clear_parser_state. */
-
-static void
-do_clear_parser_state (void *ptr)
-{
- struct parser_state **p = (struct parser_state **) ptr;
-
- *p = NULL;
-}
-
-/* Clean (i.e., set to NULL) the parser state variable P. */
-
-struct cleanup *
-make_cleanup_clear_parser_state (struct parser_state **p)
-{
- return make_cleanup (do_clear_parser_state, (void *) p);
-}
-
/* This function is useful for cleanups.
Do
diff --git a/gdb/utils.h b/gdb/utils.h
index 3ceefc1..1c8b95c 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -236,10 +236,6 @@ struct htab_deleter
/* A unique_ptr wrapper for htab_t. */
typedef std::unique_ptr<htab, htab_deleter> htab_up;
-struct parser_state;
-extern struct cleanup *make_cleanup_clear_parser_state
- (struct parser_state **p);
-
extern void free_current_contents (void *);
extern void init_page_info (void);