scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit f823cb11acb2aa72f612d8ce702fd1cd1b851d14
parent f071fe5eaccfa08807649ee69b8f8d7ee28a4505
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 31 Aug 2015 21:16:35 +0200

Include stderr in DBG()

Diffstat:
cc1/cpp.c | 6+++---
cc1/decl.c | 4++--
cc1/lex.c | 2+-
inc/cc.h | 2+-
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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