From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 2/9] Use member initializers in mi_parse
Date: Thu, 18 May 2023 14:18:08 -0600 [thread overview]
Message-ID: <20230404-dap-loaded-sources-v2-2-93f229095e03@adacore.com> (raw)
In-Reply-To: <20230404-dap-loaded-sources-v2-0-93f229095e03@adacore.com>
This changes mi_parse to use member initializers rather than a
constructor. This is easier to follow.
---
gdb/mi/mi-parse.c | 17 -----------------
gdb/mi/mi-parse.h | 28 ++++++++++++++--------------
2 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index 737ec57eddd..bda554a568e 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -208,23 +208,6 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
}
}
-mi_parse::mi_parse ()
- : op (MI_COMMAND),
- command (NULL),
- token (NULL),
- cmd (NULL),
- cmd_start (NULL),
- args (NULL),
- argv (NULL),
- argc (0),
- all (0),
- thread_group (-1),
- thread (-1),
- frame (-1),
- language (language_unknown)
-{
-}
-
mi_parse::~mi_parse ()
{
xfree (command);
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index e34796988a4..75bb36b1c77 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -41,27 +41,27 @@ enum mi_command_type
struct mi_parse
{
- mi_parse ();
+ mi_parse () = default;
~mi_parse ();
DISABLE_COPY_AND_ASSIGN (mi_parse);
- enum mi_command_type op;
- char *command;
- char *token;
- const struct mi_command *cmd;
- struct mi_timestamp *cmd_start;
- char *args;
- char **argv;
- int argc;
- int all;
- int thread_group; /* At present, the same as inferior number. */
- int thread;
- int frame;
+ enum mi_command_type op = MI_COMMAND;
+ char *command = nullptr;
+ char *token = nullptr;
+ const struct mi_command *cmd = nullptr;
+ struct mi_timestamp *cmd_start = nullptr;
+ char *args = nullptr;
+ char **argv = nullptr;
+ int argc = 0;
+ int all = 0;
+ int thread_group = -1; /* At present, the same as inferior number. */
+ int thread = -1;
+ int frame = -1;
/* The language that should be used to evaluate the MI command.
Ignored if set to language_unknown. */
- enum language language;
+ enum language language = language_unknown;
};
/* Attempts to parse CMD returning a ``struct mi_parse''. If CMD is
--
2.40.0
next prev parent reply other threads:[~2023-05-18 20:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 20:18 [PATCH v2 0/9] Implement the DAP "loadedSources" request Tom Tromey
2023-05-18 20:18 ` [PATCH v2 1/9] Use field_signed from Python MI commands Tom Tromey
2023-05-18 20:18 ` Tom Tromey [this message]
2023-05-18 20:18 ` [PATCH v2 3/9] Use accessor for mi_parse::args Tom Tromey
2023-05-18 20:18 ` [PATCH v2 4/9] Change mi_parse_argv to a method Tom Tromey
2023-05-18 20:18 ` [PATCH v2 5/9] Introduce "static constructor" for mi_parse Tom Tromey
2023-08-11 11:02 ` Andrew Burgess
2023-08-11 13:10 ` Tom Tromey
2023-08-11 15:06 ` Andrew Burgess
2023-05-18 20:18 ` [PATCH v2 6/9] Introduce mi_parse helper methods Tom Tromey
2023-05-18 20:18 ` [PATCH v2 7/9] Add second mi_parse constructor Tom Tromey
2023-05-18 20:18 ` [PATCH v2 8/9] Implement gdb.execute_mi Tom Tromey
2023-05-19 5:37 ` Eli Zaretskii
2023-05-29 15:54 ` Simon Marchi
2023-06-02 19:19 ` Tom Tromey
2023-06-08 20:16 ` Tom Tromey
2023-05-18 20:18 ` [PATCH v2 9/9] Implement DAP loadedSources request Tom Tromey
2023-05-23 19:46 ` [PATCH v2 0/9] Implement the DAP "loadedSources" request Tom Tromey
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=20230404-dap-loaded-sources-v2-2-93f229095e03@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@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).