Add --debug option to etags

* lib-src/etags.c (make_tag): Print found tags under --debug.
(longopts): Add --debug.
This commit is contained in:
Eli Zaretskii 2017-09-10 19:46:00 +03:00
parent cdef84fb68
commit 4b86cf5668

View file

@ -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. */