From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: gdb-patches@sourceware.org
Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [PUSHED] OBVIOUS Use report_unrecognized_option_error in 'demangle' and 'info macro' commands.
Date: Sat, 27 Oct 2018 19:41:00 -0000 [thread overview]
Message-ID: <20181027194135.27132-1-philippe.waroquiers@skynet.be> (raw)
Rather than have some local logic to throw an error for an unrecognized option,
use the new cli-utils.h function throwing an error.
At the same time, fix some wrong indentation in info_macro_command
and fix a small bug in 'demangle' error handling:
Without the patch:
(gdb) demangle -L c++ abcd
Unrecognized option 'c++' to demangle command. Try "help demangle".
(gdb)
With the patch:
(gdb) demangle -L c++ abcd
Unrecognized option '-L' to demangle command. Try "help demangle".
2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* macrocmd.c (info_macro_command): Use report_unrecognized_option_error
to report a bad option and fix indentation.
* demangle.c (demangle_command): Use report_unrecognized_option_error
to report a bad option and correctly report the bad option.
---
gdb/ChangeLog | 7 +++++++
gdb/demangle.c | 6 +-----
gdb/macrocmd.c | 8 ++------
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2fb66c619c..ff36b9b1f1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-27 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * macrocmd.c (info_macro_command): Use report_unrecognized_option_error
+ to report a bad option and fix indentation.
+ * demangle.c (demangle_command): Use report_unrecognized_option_error
+ to report a bad option and correctly report the bad option.
+
2018-10-27 Tom Tromey <tom@tromey.com>
PR cli/23364:
diff --git a/gdb/demangle.c b/gdb/demangle.c
index a37b065893..8b341ee67b 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -180,11 +180,7 @@ demangle_command (const char *args, int from_tty)
else if (strncmp (arg_start, "--", p - arg_start) == 0)
processing_args = 0;
else
- {
- std::string option = extract_arg (&p);
- error (_("Unrecognized option '%s' to demangle command. "
- "Try \"help demangle\"."), option.c_str ());
- }
+ report_unrecognized_option_error ("demangle", arg_start);
arg_start = skip_spaces (p);
}
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index e6cf921a1b..110423fbae 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -199,13 +199,9 @@ info_macro_command (const char *args, int from_tty)
e.g. Scheme's (defmacro ->foo () "bar\n") */
processing_args = 0;
else
- {
- error (_("Unrecognized option '%.*s' to info macro command. "
- "Try \"help info macro\"."),
- int (p - arg_start), arg_start);
- }
+ report_unrecognized_option_error ("info macro", arg_start);
- arg_start = skip_spaces (p);
+ arg_start = skip_spaces (p);
}
name = arg_start;
--
2.19.1
reply other threads:[~2018-10-27 19:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20181027194135.27132-1-philippe.waroquiers@skynet.be \
--to=philippe.waroquiers@skynet.be \
--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).