ack/util/led/debug.h
George Koehler 3f3bf1e164 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 18:27:34 -04:00

27 lines
539 B
C

/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
#ifndef __DEBUG_H_INCLUDED__
#define __DEBUG_H_INCLUDED__
#include "error.h"
#ifdef NDEBUG
#define debug(s, a1, a2, a3, a4)
#else
extern int DEB;
#define debug(s, a1, a2, a3, a4) (DEB && do_debug(s, a1, a2, a3, a4))
#endif
extern int Verbose;
#define verbose(s, a1, a2, a3, a4) (Verbose && do_verbose(s, a1, a2, a3, a4))
#endif /* __DEBUG_H_INCLUDED__ */