From cdba64071cada4caf017884bc3ca7eba76c05e18 Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Tue, 17 Sep 2002 22:31:26 +0000 Subject: Move common use of if (DEBUG(FOO)) printf... to DEBUGF(FOO, ...), using variable length arguments to a macro. Bump version as this makes DEBUG statements *always* go to stderr rather than sometimes stdout. There are a few stragglers, which I will take care of as soon as I can. Mostly these relate to the need-for-death-of some of the remote job code. Nearby stylistic nits and XXX added/fixed where appropriate. --- usr.bin/make/make.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'usr.bin/make/make.h') diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 465ee38e92630..6976a899e85f8 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -338,6 +338,13 @@ extern int debug; #define CONCAT(a,b) a##b #define DEBUG(module) (debug & CONCAT(DEBUG_,module)) +#define DEBUGF(module,fmt,args...) \ +do { \ + if (DEBUG(module)) { \ + fprintf(stderr, fmt, ##args); \ + fflush(stderr); \ + } \ +} while (0) #define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/'))) #define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1]))) -- cgit v1.3