* [PATCH, applied] abilint: Support --annotate
@ 2023-12-01 14:54 Dodji Seketeli
0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2023-12-01 14:54 UTC (permalink / raw)
To: libabigail; +Cc: dodji
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-01 14:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 14:54 [PATCH, applied] abilint: Support --annotate Dodji Seketeli
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).