1987-03-09 19:15:41 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1994-06-24 11:31:16 +00:00
|
|
|
/* $Id$ */
|
1985-01-10 13:35:39 +00:00
|
|
|
|
2019-03-24 09:08:45 +00:00
|
|
|
#ifndef __DEBUG_H_INCLUDED__
|
|
|
|
#define __DEBUG_H_INCLUDED__
|
|
|
|
|
Reduce warnings, adjust format strings in util/led
Calls like `debug("something\n", 0, 0, 0, 0)` cause clang warnings,
because debug() is a macro that passes its arguments to printf(), and
clang warns about extra 0s to printf(). Silence the warnings by
hiding the printf() in a new function do_debug(). The code still
passes extra 0s to printf(), but clang can't warn.
Macros debug() and verbose() should use C99 __VA_ARGS__, so they don't
require the extra 0s; but ACK doesn't use __VA_ARGS__ yet.
Adjust some format strings for debug() or fatal(), or cast their
arguments, to match their types. I don't know whether uint32_t is
unsigned int or unsigned long, so I cast it to unsigned long, and
print it with "%lx".
In util/led/sym.c, #include "save.h" to declare savechar(), and use
parentheses to silence a clang warning in hash().
2019-11-01 22:27:34 +00:00
|
|
|
#include "error.h"
|
2019-03-24 09:08:45 +00:00
|
|
|
|
1985-01-10 13:35:39 +00:00
|
|
|
#ifdef NDEBUG
|
|
|
|
|
1986-10-20 10:17:57 +00:00
|
|
|
#define debug(s, a1, a2, a3, a4)
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
#else
|
1986-10-20 10:17:57 +00:00
|
|
|
extern int DEB;
|
1985-01-10 13:35:39 +00:00
|
|
|
|
Reduce warnings, adjust format strings in util/led
Calls like `debug("something\n", 0, 0, 0, 0)` cause clang warnings,
because debug() is a macro that passes its arguments to printf(), and
clang warns about extra 0s to printf(). Silence the warnings by
hiding the printf() in a new function do_debug(). The code still
passes extra 0s to printf(), but clang can't warn.
Macros debug() and verbose() should use C99 __VA_ARGS__, so they don't
require the extra 0s; but ACK doesn't use __VA_ARGS__ yet.
Adjust some format strings for debug() or fatal(), or cast their
arguments, to match their types. I don't know whether uint32_t is
unsigned int or unsigned long, so I cast it to unsigned long, and
print it with "%lx".
In util/led/sym.c, #include "save.h" to declare savechar(), and use
parentheses to silence a clang warning in hash().
2019-11-01 22:27:34 +00:00
|
|
|
#define debug(s, a1, a2, a3, a4) (DEB && do_debug(s, a1, a2, a3, a4))
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
#endif
|
1990-03-15 10:44:14 +00:00
|
|
|
|
|
|
|
extern int Verbose;
|
|
|
|
#define verbose(s, a1, a2, a3, a4) (Verbose && do_verbose(s, a1, a2, a3, a4))
|
2017-01-15 10:51:37 +00:00
|
|
|
|
2019-03-24 09:08:45 +00:00
|
|
|
#endif /* __DEBUG_H_INCLUDED__ */
|