diff options
author | Paul Smith <psmith@gnu.org> | 2022-10-23 18:36:44 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-10-23 18:41:50 -0400 |
commit | c46b5a9e0e06678052d4561401eea96d2f677d05 (patch) | |
tree | caba783d30b78f208797efe76ff7a3daaaf6e2ff /src/makeint.h | |
parent | b4157d2ff4f7e278e3cc507b82569d37b3a1b586 (diff) | |
download | make-git-c46b5a9e0e06678052d4561401eea96d2f677d05.tar.gz |
Provide a maintainer-only debug method
Generating debug logs to stdout or stderr makes it impossible to
run tests etc. so create a dumb DBG facility to log to a temp file.
This exists only in maintainer mode and the DBG macro gives a
compile error if it's used in non-maintainer mode.
* src/makeint.h (DBG): Call dbg() in maintainer mode, else error.
(dbg): Define it in maintainer mode.
* src/misc.c (dbg): Open a log file for append, write, then close.
Diffstat (limited to 'src/makeint.h')
-rw-r--r-- | src/makeint.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/makeint.h b/src/makeint.h index f9de63d0..e345011b 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -658,8 +658,12 @@ int unload_file (const char *name); #ifdef MAKE_MAINTAINER_MODE # define SPIN(_s) spin (_s) void spin (const char* suffix); +# define DBG(_f) dbg _f +void dbg (const char *fmt, ...); #else # define SPIN(_s) +/* Never put this code into Git or a release. */ +# define DBG(_f) compile-error #endif /* We omit these declarations on non-POSIX systems which define _POSIX_VERSION, |