[hackers] [scc] Include stderr in DBG() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 31 Aug 2015 21:18:35 +0200 (CEST)

commit f823cb11acb2aa72f612d8ce702fd1cd1b851d14
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Aug 31 21:16:35 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
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
_AT_@ -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 */
_AT_@ -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
_AT_@ -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);
         }
 
_AT_@ -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
_AT_@ -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
_AT_@ -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
Received on Mon Aug 31 2015 - 21:18:35 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 31 2015 - 21:24:11 CEST