aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-02-07 18:59:28 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-02-07 18:59:28 +0200
commite0db6733fc8563896090f678d382375897757d18 (patch)
treeb3810e2c34fe48b51de0e58a3d15e2b687558c4e /src
parent28da8cf2af6a181fd8a51613107415da3f07dd2e (diff)
downloadcflow-e0db6733fc8563896090f678d382375897757d18.tar.gz
cflow-e0db6733fc8563896090f678d382375897757d18.tar.bz2
Output debugging info to stderr instead of stdout.
Diffstat (limited to 'src')
-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 @@
1/* This file is part of GNU cflow 1/* This file is part of GNU cflow
2 Copyright (C) 1997, 2005, 2007, 2010 Sergey Poznyakoff 2 Copyright (C) 1997, 2005, 2007, 2010, 2014 Sergey Poznyakoff
3 3
4 GNU cflow is free software; you can redistribute it and/or modify 4 GNU cflow is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -335,7 +335,7 @@ pp_open(const char *name)
335 strcat(s, " "); 335 strcat(s, " ");
336 strcat(s, name); 336 strcat(s, name);
337 if (debug) 337 if (debug)
338 printf(_("Command line: %s\n"), s); 338 fprintf(stderr, _("Command line: %s\n"), s);
339 fp = popen(s, "r"); 339 fp = popen(s, "r");
340 if (!fp) 340 if (!fp)
341 error(0, errno, _("cannot execute `%s'"), s); 341 error(0, errno, _("cannot execute `%s'"), s);
@@ -474,6 +474,6 @@ update_loc()
474 filename = obstack_finish(&string_stk); 474 filename = obstack_finish(&string_stk);
475 } 475 }
476 if (debug > 1) 476 if (debug > 1)
477 printf(_("New location: %s:%d\n"), filename, line_num); 477 fprintf(stderr, _("New location: %s:%d\n"), filename, line_num);
478} 478}
479 479
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()
743 if (level_end[1] == NULL) 743 if (level_end[1] == NULL)
744 level_end[1] = ""; 744 level_end[1] = "";
745 745
746 init_lex(debug > 1); 746 init_lex(debug > 2);
747 init_parse(); 747 init_parse();
748} 748}
749 749
@@ -751,7 +751,7 @@ const char version_etc_copyright[] =
751 /* Do *not* mark this string for translation. %s is a copyright 751 /* Do *not* mark this string for translation. %s is a copyright
752 symbol suitable for this locale, and %d is the copyright 752 symbol suitable for this locale, and %d is the copyright
753 year. */ 753 year. */
754 "Copyright %s 2005, 2006, 2009, 2010, 2011 %d Sergey Poznyakoff"; 754 "Copyright %s 2005, 2006, 2009, 2010, 2011, 2014 %d Sergey Poznyakoff";
755 755
756int 756int
757main(int argc, char **argv) 757main(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 @@
1/* This file is part of GNU cflow 1/* This file is part of GNU cflow
2 Copyright (C) 1997, 2005, 2006, 2007, 2009, 2010, 2011, 2014 Sergey Poznyakoff 2 Copyright (C) 1997, 2005, 2006, 2007, 2009, 2010, 2011,
3 2014 Sergey Poznyakoff
3 4
4 GNU cflow is free software; you can redistribute it and/or modify 5 GNU cflow is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -171,11 +172,11 @@ static void
171dbgtok(TOKSTK *t, int delim) 172dbgtok(TOKSTK *t, int delim)
172{ 173{
173 if (delim) 174 if (delim)
174 putchar(delim); 175 fputc(delim, stderr);
175 printf("{ %s ", token_type_str(t->type)); 176 fprintf(stderr, "{ %s ", token_type_str(t->type));
176 if (t->type) 177 if (t->type)
177 printf(", %s, %d ", t->token ? t->token : "NULL", t->line); 178 fprintf(stderr, ", %s, %d ", t->token ? t->token : "NULL", t->line);
178 putchar('}'); 179 fputc('}', stderr);
179} 180}
180 181
181static void 182static void
@@ -187,18 +188,18 @@ debugtoken(TOKSTK *t, char *fmt, ...)
187 188
188 if (fmt) { 189 if (fmt) {
189 va_start(ap, fmt); 190 va_start(ap, fmt);
190 vprintf(fmt, ap); 191 vfprintf(stderr, fmt, ap);
191 va_end(ap); 192 va_end(ap);
192 printf(": "); 193 fprintf(stderr, ": ");
193 } 194 }
194 if (t) { 195 if (t) {
195 dbgtok(t, 0); 196 dbgtok(t, 0);
196 printf("; "); 197 fprintf(stderr, "; ");
197 } 198 }
198 printf("%d: {", curs); 199 fprintf(stderr, "%d: {", curs);
199 for (i = curs; i < tos; i++) 200 for (i = curs; i < tos; i++)
200 dbgtok(token_stack + i, i == curs ? 0 : ','); 201 dbgtok(token_stack + i, i == curs ? 0 : ',');
201 printf("}\n"); 202 fprintf(stderr, "}\n");
202 } 203 }
203} 204}
204 205
@@ -217,8 +218,8 @@ void
217mark(Stackpos pos) 218mark(Stackpos pos)
218{ 219{
219 pos[0] = curs; 220 pos[0] = curs;
220 if (debug > 2) 221 if (debug > 1)
221 printf("marking stack at %d\n", curs); 222 fprintf(stderr, "marking stack at %d\n", curs);
222} 223}
223 224
224void 225void
@@ -1177,7 +1178,7 @@ declare(Ident *ident, int maybe_knr)
1177 sp->def_line = ident->line; 1178 sp->def_line = ident->line;
1178 sp->level = level; 1179 sp->level = level;
1179 if (debug) 1180 if (debug)
1180 printf(_("%s:%d: %s/%d defined to %s\n"), 1181 fprintf(stderr, _("%s:%d: %s/%d defined to %s\n"),
1181 filename, 1182 filename,
1182 line_num, 1183 line_num,
1183 ident->name, ident->parmcnt, 1184 ident->name, ident->parmcnt,
@@ -1202,7 +1203,8 @@ declare_type(Ident *ident)
1202 sp->def_line = ident->line; 1203 sp->def_line = ident->line;
1203 sp->ref_line = NULL; 1204 sp->ref_line = NULL;
1204 if (debug) 1205 if (debug)
1205 printf(_("%s:%d: type %s\n"), filename, line_num, ident->name); 1206 fprintf(stderr, _("%s:%d: type %s\n"), filename, line_num,
1207 ident->name);
1206} 1208}
1207 1209
1208Symbol * 1210Symbol *

Return to:

Send suggestions and report system problems to the System administrator.