commit f823cb11acb2aa72f612d8ce702fd1cd1b851d14
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Mon Aug 31 21:16:35 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Mon Aug 31 21:16:35 2015 +0200

    Include stderr in DBG()

diff --git a/cc1/cpp.c b/cc1/cpp.c
index ee612ee..0516c65 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -218,12 +218,12 @@ expand(char *begin, Symbol *sym)
        if (!parsepars(arguments, arglist, atoi(s)))
                return 0;
        for (n = 0; n < atoi(s); ++n)
-               DBG(stderr, "MACRO par%d:%s\n", n, arglist[n]);
+               DBG("MACRO par%d:%s\n", n, arglist[n]);
 
        elen = copymacro(buffer, s+3, INPUTSIZ-1, arglist);
 
 substitute:
-       DBG(stderr, "MACRO '%s' expanded to :'%s'\n", macroname, buffer);
+       DBG("MACRO '%s' expanded to :'%s'\n", macroname, buffer);
        rlen = strlen(input->p);      /* rigth length */
        llen = begin - input->line;   /* left length */
        ilen = input->p - begin;      /* invocation length */
@@ -352,7 +352,7 @@ define(void)
        if (!getdefs(args, n, buff+3, LINESIZ-3))
                goto delete;
        sym->u.s = xstrdup(buff);
-       DBG(stderr, "MACRO '%s' defined as '%s'\n", sym->name, buff);
+       DBG("MACRO '%s' defined as '%s'\n", sym->name, buff);
        return;
 
 delete:
diff --git a/cc1/decl.c b/cc1/decl.c
index b615c2f..a31ff9e 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -407,7 +407,7 @@ newtag(void)
                tp->p.fields = NULL;
                sym->type = tp;
                tp->tag = sym;
-               DBG(stderr, "declared tag '%s' with ns = %d\n",
+               DBG("declared tag '%s' with ns = %d\n",
                    (sym->name) ? sym->name : "anonymous", tp->ns);
        }
 
@@ -546,7 +546,7 @@ field(struct decl *dcl)
        sym->flags |= ISFIELD;
        if (n == NR_FIELDS)
                error("too much fields in struct/union");
-       DBG(stderr, "New field '%s' in namespace %d\n", name, structp->ns);
+       DBG("New field '%s' in namespace %d\n", name, structp->ns);
        structp->p.fields = xrealloc(structp->p.fields, ++n * sizeof(*sym));
        structp->p.fields[n-1] = sym;
        structp->n.elem = n;
diff --git a/cc1/lex.c b/cc1/lex.c
index 1c61f0d..3df6ab1 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -531,7 +531,7 @@ next(void)
                yytoken = operator();
 
 exit:
-       DBG(stderr, "TOKEN %s\n", yytext);
+       DBG("TOKEN %s\n", yytext);
        return yytoken;
 }
 
diff --git a/inc/cc.h b/inc/cc.h
index 990822d..b7f2f89 100644
--- a/inc/cc.h
+++ b/inc/cc.h
@@ -8,7 +8,7 @@ typedef unsigned bool;
 #endif
 
 #ifndef NDEBUG
-#define DBG(...) fprintf(__VA_ARGS__)
+#define DBG(...) fprintf(stderr, __VA_ARGS__)
 #else
 #define DBG(...)
 #endif

Reply via email to