summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2014-02-07 16:59:28 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2014-02-07 16:59:28 (GMT)
commite0db6733fc8563896090f678d382375897757d18 (patch) (side-by-side diff)
treeb3810e2c34fe48b51de0e58a3d15e2b687558c4e /src
parent28da8cf2af6a181fd8a51613107415da3f07dd2e (diff)
downloadcflow-e0db6733fc8563896090f678d382375897757d18.tar.gz
cflow-e0db6733fc8563896090f678d382375897757d18.tar.bz2
Output debugging info to stderr instead of stdout.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/c.l6
-rw-r--r--src/main.c4
-rw-r--r--src/parser.c30
3 files changed, 21 insertions, 19 deletions
diff --git a/src/c.l b/src/c.l
index f3467e8..d0466ed 100644
--- a/src/c.l
+++ b/src/c.l
@@ -1,5 +1,5 @@
/* This file is part of GNU cflow
- Copyright (C) 1997, 2005, 2007, 2010 Sergey Poznyakoff
+ Copyright (C) 1997, 2005, 2007, 2010, 2014 Sergey Poznyakoff
GNU cflow is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -335,7 +335,7 @@ pp_open(const char *name)
strcat(s, " ");
strcat(s, name);
if (debug)
- printf(_("Command line: %s\n"), s);
+ fprintf(stderr, _("Command line: %s\n"), s);
fp = popen(s, "r");
if (!fp)
error(0, errno, _("cannot execute `%s'"), s);
@@ -474,6 +474,6 @@ update_loc()
filename = obstack_finish(&string_stk);
}
if (debug > 1)
- printf(_("New location: %s:%d\n"), filename, line_num);
+ fprintf(stderr, _("New location: %s:%d\n"), filename, line_num);
}
diff --git a/src/main.c b/src/main.c
index 6c51033..34db7a1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -743,7 +743,7 @@ init()
if (level_end[1] == NULL)
level_end[1] = "";
- init_lex(debug > 1);
+ init_lex(debug > 2);
init_parse();
}
@@ -751,7 +751,7 @@ const char version_etc_copyright[] =
/* Do *not* mark this string for translation. %s is a copyright
symbol suitable for this locale, and %d is the copyright
year. */
- "Copyright %s 2005, 2006, 2009, 2010, 2011 %d Sergey Poznyakoff";
+ "Copyright %s 2005, 2006, 2009, 2010, 2011, 2014 %d Sergey Poznyakoff";
int
main(int argc, char **argv)
diff --git a/src/parser.c b/src/parser.c
index bdb9e22..8dc2a4f 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1,5 +1,6 @@
/* This file is part of GNU cflow
- Copyright (C) 1997, 2005, 2006, 2007, 2009, 2010, 2011, 2014 Sergey Poznyakoff
+ Copyright (C) 1997, 2005, 2006, 2007, 2009, 2010, 2011,
+ 2014 Sergey Poznyakoff
GNU cflow is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -171,11 +172,11 @@ static void
dbgtok(TOKSTK *t, int delim)
{
if (delim)
- putchar(delim);
- printf("{ %s ", token_type_str(t->type));
+ fputc(delim, stderr);
+ fprintf(stderr, "{ %s ", token_type_str(t->type));
if (t->type)
- printf(", %s, %d ", t->token ? t->token : "NULL", t->line);
- putchar('}');
+ fprintf(stderr, ", %s, %d ", t->token ? t->token : "NULL", t->line);
+ fputc('}', stderr);
}
static void
@@ -187,18 +188,18 @@ debugtoken(TOKSTK *t, char *fmt, ...)
if (fmt) {
va_start(ap, fmt);
- vprintf(fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
- printf(": ");
+ fprintf(stderr, ": ");
}
if (t) {
dbgtok(t, 0);
- printf("; ");
+ fprintf(stderr, "; ");
}
- printf("%d: {", curs);
+ fprintf(stderr, "%d: {", curs);
for (i = curs; i < tos; i++)
dbgtok(token_stack + i, i == curs ? 0 : ',');
- printf("}\n");
+ fprintf(stderr, "}\n");
}
}
@@ -217,8 +218,8 @@ void
mark(Stackpos pos)
{
pos[0] = curs;
- if (debug > 2)
- printf("marking stack at %d\n", curs);
+ if (debug > 1)
+ fprintf(stderr, "marking stack at %d\n", curs);
}
void
@@ -1177,7 +1178,7 @@ declare(Ident *ident, int maybe_knr)
sp->def_line = ident->line;
sp->level = level;
if (debug)
- printf(_("%s:%d: %s/%d defined to %s\n"),
+ fprintf(stderr, _("%s:%d: %s/%d defined to %s\n"),
filename,
line_num,
ident->name, ident->parmcnt,
@@ -1202,7 +1203,8 @@ declare_type(Ident *ident)
sp->def_line = ident->line;
sp->ref_line = NULL;
if (debug)
- printf(_("%s:%d: type %s\n"), filename, line_num, ident->name);
+ fprintf(stderr, _("%s:%d: type %s\n"), filename, line_num,
+ ident->name);
}
Symbol *

Return to:

Send suggestions and report system problems to the System administrator.