From 4b86cf5668ef70b9ee71975e5c3f5d47b08f4e37 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Sep 2017 19:46:00 +0300 Subject: [PATCH] Add --debug option to etags * lib-src/etags.c (make_tag): Print found tags under --debug. (longopts): Add --debug. --- lib-src/etags.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib-src/etags.c b/lib-src/etags.c index 38be60e9cbb..1d0fa292079 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -462,6 +462,7 @@ static bool cplusplus; /* .[hc] means C++, not C (undocumented) */ static bool ignoreindent; /* -I: ignore indentation in C */ static int packages_only; /* --packages-only: in Ada, only tag packages*/ static int class_qualify; /* -Q: produce class-qualified tags in C++/Java */ +static int debug; /* --debug */ /* STDIN is defined in LynxOS system headers */ #ifdef STDIN @@ -479,6 +480,7 @@ static struct option longopts[] = { "append", no_argument, NULL, 'a' }, { "packages-only", no_argument, &packages_only, 1 }, { "c++", no_argument, NULL, 'C' }, + { "debug", no_argument, &debug, 1 }, { "declarations", no_argument, &declarations, 1 }, { "no-line-directive", no_argument, &no_line_directive, 1 }, { "no-duplicates", no_argument, &no_duplicates, 1 }, @@ -1917,6 +1919,10 @@ make_tag (const char *name, /* tag name, or NULL if unnamed */ bool named = (name != NULL && namelen > 0); char *nname = NULL; + if (debug) + fprintf (stderr, "%s on %s:%d: %s\n", + named ? name : "(unnamed)", curfdp->taggedfname, lno, linestart); + if (!CTAGS && named) /* maybe set named to false */ /* Let's try to make an implicit tag name, that is, create an unnamed tag such that etags.el can guess a name from it. */ -- 2.11.4.GIT