From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Cc: dodji@redhat.com
Subject: [PATCH, applied] abilint: Support --annotate
Date: Fri, 01 Dec 2023 15:54:12 +0100 [thread overview]
Message-ID: <87leaenfcb.fsf@redhat.com> (raw)
Hello,
It turns out abilint doesn't support the "--annotate" option like
abidw does. Annoying. Added thus.
* tools/abilint.cc (options::annotate): Define new data member.
(options::options): Initialize.
(display_usage): Add help string.
(parse_command): Support the --annotate command options.
(main): Set the annotate option on the context.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
doc/manuals/abilint.rst | 7 +++++++
tools/abilint.cc | 10 +++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/doc/manuals/abilint.rst b/doc/manuals/abilint.rst
index 4213a22e..594dd4c2 100644
--- a/doc/manuals/abilint.rst
+++ b/doc/manuals/abilint.rst
@@ -27,6 +27,13 @@ Invocation
Options
=======
+ * ``--annotate``
+
+ Annotate the ABIXML output with comments above most elements. The
+ comments are made of the pretty-printed form of types, declaration
+ or even ELF symbols. The purpose is to make the ABIXML output
+ more human-readable for debugging or documenting purposes.
+
* ``--help``
Display a short help message and exits.
diff --git a/tools/abilint.cc b/tools/abilint.cc
index 91718067..9c6ed897 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -81,6 +81,7 @@ struct options
bool read_tu;
bool diff;
bool noout;
+ bool annotate;
#ifdef WITH_CTF
bool use_ctf;
#endif
@@ -97,7 +98,8 @@ struct options
read_from_stdin(false),
read_tu(false),
diff(false),
- noout(false)
+ noout(false),
+ annotate(false)
#ifdef WITH_CTF
,
use_ctf(false)
@@ -493,6 +495,7 @@ display_usage(const string& prog_name, ostream& out)
<< " --diff for xml inputs, perform a text diff between "
"the input and the memory model saved back to disk\n"
<< " --noout do not display anything on stdout\n"
+ << " --annotate annotate the ABI artifacts emitted in the output\n"
<< " --stdin read abi-file content from stdin\n"
<< " --tu expect a single translation unit file\n"
#ifdef WITH_CTF
@@ -583,6 +586,8 @@ parse_command_line(int argc, char* argv[], options& opts)
opts.diff = true;
else if (!strcmp(argv[i], "--noout"))
opts.noout = true;
+ else if (!strcmp(argv[i], "--annotate"))
+ opts.annotate = true;
#ifdef WITH_SHOW_TYPE_USE_IN_ABILINT
else if (!strcmp(argv[i], "--show-type-use"))
{
@@ -723,6 +728,7 @@ main(int argc, char* argv[])
{
const write_context_sptr& ctxt
= create_write_context(env, cout);
+ set_annotate(*ctxt, opts.annotate);
write_translation_unit(*ctxt, *tu, 0);
}
return 0;
@@ -739,6 +745,7 @@ main(int argc, char* argv[])
{
const write_context_sptr& ctxt
= create_write_context(env, cout);
+ set_annotate(*ctxt, opts.annotate);
write_corpus(*ctxt, corp, /*indent=*/0);
}
return 0;
@@ -879,6 +886,7 @@ main(int argc, char* argv[])
{
if (!opts.noout)
{
+ set_annotate(*ctxt, opts.annotate);
if (corp)
is_ok = write_corpus(*ctxt, corp, 0);
else if (group)
--
2.39.3
--
Dodji
reply other threads:[~2023-12-01 14:54 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=87leaenfcb.fsf@redhat.com \
--to=dodji@redhat.com \
--cc=libabigail@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).