Change void_context_p to bool
authorTom Tromey <tom@tromey.com>
Wed, 16 Dec 2020 22:12:55 +0000 (15:12 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 16 Dec 2020 22:17:43 +0000 (15:17 -0700)
This patch changes void_context_p to bool, as a prerequisite to the
change to post_parser that I submitted here:

https://sourceware.org/pipermail/gdb-patches/2020-December/174080.html

Tested by rebuilding.

Note that nothing in-tree passes true here.  I don't know why this is,
but there is a use of this internally in AdaCore's tree.  I will try
to submit that patch, if it is needed.  (And if not, I will come back
around and remove this.)

gdb/ChangeLog
2020-12-16  Tom Tromey  <tom@tromey.com>

* parse.c (parse_exp_1, parse_expression_for_completion): Update.
(parse_exp_in_context): Change void_context_p to bool.
* language.h (struct language_defn) <post_parser>: Change
void_context_p to bool.
* ada-lang.c (class ada_language) <post_parser>: Update.

gdb/ChangeLog
gdb/ada-lang.c
gdb/language.h
gdb/parse.c

index 5dc879b0443375584e6d644c548d2f348852e324..7b8e727b58cdcbd6c6d42b4011f6e1cb59a18aff 100644 (file)
@@ -1,3 +1,11 @@
+2020-12-16  Tom Tromey  <tom@tromey.com>
+
+       * parse.c (parse_exp_1, parse_expression_for_completion): Update.
+       (parse_exp_in_context): Change void_context_p to bool.
+       * language.h (struct language_defn) <post_parser>: Change
+       void_context_p to bool.
+       * ada-lang.c (class ada_language) <post_parser>: Update.
+
 2020-12-16  Tom Tromey  <tom@tromey.com>
            Tom Tromey  <tromey@redhat.com>
            Tom de Vries  <tdevries@suse.de>
index 8f437fcff3c87dcd8a2eb10b67ee1058da8d031a..23d7a164609025ae4f3205bddda18c7f2b7b6e93 100644 (file)
@@ -14124,7 +14124,7 @@ public:
      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,
+  void post_parser (expression_up *expp, bool void_context_p, int completing,
                    innermost_block_tracker *tracker) const override
   {
     struct type *context_type = NULL;
index e955340440de57d269c86a2770b0b6ea06a51bfc..5bc99d5f241a111effbf822c8437101ff773f455 100644 (file)
@@ -527,7 +527,7 @@ struct language_defn
      non-zero, then the expression has been parsed for completion, not
      evaluation.  */
 
-  virtual void post_parser (expression_up *expp, int void_context_p,
+  virtual void post_parser (expression_up *expp, bool void_context_p,
                            int completing,
                            innermost_block_tracker *tracker) const
   {
index 73d82e64a87a6a12d07a3df73ef3b1824cc452e0..a27ae86c0010f6724b842fd609e1db36de792da4 100644 (file)
@@ -88,7 +88,7 @@ static int prefixify_subexp (struct expression *, struct expression *, int,
 
 static expression_up parse_exp_in_context (const char **, CORE_ADDR,
                                           const struct block *, int,
-                                          int, int *,
+                                          bool, int *,
                                           innermost_block_tracker *,
                                           expr_completion_state *);
 
@@ -1028,7 +1028,7 @@ expression_up
 parse_exp_1 (const char **stringptr, CORE_ADDR pc, const struct block *block,
             int comma, innermost_block_tracker *tracker)
 {
-  return parse_exp_in_context (stringptr, pc, block, comma, 0, NULL,
+  return parse_exp_in_context (stringptr, pc, block, comma, false, NULL,
                               tracker, nullptr);
 }
 
@@ -1042,7 +1042,7 @@ parse_exp_1 (const char **stringptr, CORE_ADDR pc, const struct block *block,
 static expression_up
 parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
                      const struct block *block,
-                     int comma, int void_context_p, int *out_subexp,
+                     int comma, bool void_context_p, int *out_subexp,
                      innermost_block_tracker *tracker,
                      expr_completion_state *cstate)
 {
@@ -1205,7 +1205,7 @@ parse_expression_for_completion (const char *string,
 
   try
     {
-      exp = parse_exp_in_context (&string, 0, 0, 0, 0, &subexp,
+      exp = parse_exp_in_context (&string, 0, 0, 0, false, &subexp,
                                  nullptr, &cstate);
     }
   catch (const gdb_exception_error &except)