From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Clean up unusual code in mi-cmd-stack.c
Date: Wed, 25 Jan 2023 08:06:09 -0700 [thread overview]
Message-ID: <20230125150609.3987536-1-tromey@adacore.com> (raw)
I noticed some unusual code in mi-cmd-stack.c. This code is a switch,
where one of the cases appears in the middle of another block. It
seemed cleaner to me to have the earlier case just conditionally fall
through.
---
gdb/mi/mi-cmd-stack.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 00e61e04b67..4666808a9c9 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -571,7 +571,6 @@ list_args_or_locals (const frame_print_options &fp_opts,
const struct block *block;
struct symbol *sym;
struct block_iterator iter;
- struct type *type;
const char *name_of_result;
struct ui_out *uiout = current_uiout;
@@ -649,17 +648,20 @@ list_args_or_locals (const frame_print_options &fp_opts,
switch (values)
{
case PRINT_SIMPLE_VALUES:
- type = check_typedef (sym2->type ());
- if (type->code () != TYPE_CODE_ARRAY
- && type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION)
- {
+ {
+ struct type *type = check_typedef (sym2->type ());
+ if (type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
+ break;
+ }
+ /* FALLTHROUGH */
+
case PRINT_ALL_VALUES:
if (sym->is_argument ())
read_frame_arg (fp_opts, sym2, fi, &arg, &entryarg);
else
read_frame_local (sym2, fi, &arg);
- }
break;
}
--
2.38.1
next reply other threads:[~2023-01-25 15:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 15:06 Tom Tromey [this message]
2023-01-25 18:14 ` Simon Marchi
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=20230125150609.3987536-1-tromey@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).