Fix compiler warnings about unused value in TRACE macros.
* src/debug.h: Change macros to not have a literal 0 as last expression of the comma operator. * src/debug.c (_gpgme_debug_frame_end): Return 0. (_gpgme_debug): Return 0. -- Instead of using foo(), 0 for the trace macros we let foo() return 0 instead. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
a5b040cc57
commit
8b9f84828c
19
src/debug.c
19
src/debug.c
@ -80,11 +80,12 @@ _gpgme_debug_frame_begin (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void _gpgme_debug_frame_end (void)
|
||||
int _gpgme_debug_frame_end (void)
|
||||
{
|
||||
#ifdef FRAME_NR
|
||||
frame_nr--;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -223,8 +224,17 @@ _gpgme_debug_subsystem_init (void)
|
||||
|
||||
|
||||
|
||||
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
|
||||
void
|
||||
/* Log the formatted string FORMAT at debug level LEVEL or higher.
|
||||
*
|
||||
* Returns: 0
|
||||
*
|
||||
* Note that we always return 0 because the old TRACE macro evaluated
|
||||
* to 0 which issues a warning with newer gcc version about an unused
|
||||
* values. By using a return value of this function this can be
|
||||
* avoided. Fixme: It might be useful to check whether the return
|
||||
* value from the TRACE macros are actually used somewhere.
|
||||
*/
|
||||
int
|
||||
_gpgme_debug (int level, const char *format, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
@ -232,7 +242,7 @@ _gpgme_debug (int level, const char *format, ...)
|
||||
|
||||
saved_errno = errno;
|
||||
if (debug_level < level)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
va_start (arg_ptr, format);
|
||||
LOCK (debug_lock);
|
||||
@ -273,6 +283,7 @@ _gpgme_debug (int level, const char *format, ...)
|
||||
fflush (errfp);
|
||||
|
||||
gpg_err_set_errno (saved_errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
63
src/debug.h
63
src/debug.h
@ -64,7 +64,7 @@ int _gpgme_debug_set_debug_envvar (const char *value);
|
||||
void _gpgme_debug_subsystem_init (void);
|
||||
|
||||
/* Log the formatted string FORMAT at debug level LEVEL or higher. */
|
||||
void _gpgme_debug (int level, const char *format, ...);
|
||||
int _gpgme_debug (int level, const char *format, ...);
|
||||
|
||||
/* Start a new debug line in *LINE, logged at level LEVEL or higher,
|
||||
and starting with the formatted string FORMAT. */
|
||||
@ -82,7 +82,7 @@ void _gpgme_debug_buffer (int lvl, const char *const fmt,
|
||||
size_t len);
|
||||
|
||||
void _gpgme_debug_frame_begin (void);
|
||||
void _gpgme_debug_frame_end (void);
|
||||
int _gpgme_debug_frame_end (void);
|
||||
|
||||
static inline gpgme_error_t
|
||||
_gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
|
||||
@ -108,82 +108,80 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
|
||||
#define TRACE_BEG(lvl, name, tag) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag)
|
||||
#define TRACE_BEG0(lvl, name, tag, fmt) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag)
|
||||
#define TRACE_BEG1(lvl, name, tag, fmt, arg1) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1), 0
|
||||
arg1)
|
||||
#define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2), 0
|
||||
arg1, arg2)
|
||||
#define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3), 0
|
||||
arg1, arg2, arg3)
|
||||
#define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4), 0
|
||||
arg1, arg2, arg3, arg4)
|
||||
#define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4, arg5), 0
|
||||
arg1, arg2, arg3, arg4, arg5)
|
||||
#define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
|
||||
arg5, arg6, arg7) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4, arg5, \
|
||||
arg6, arg7), 0
|
||||
arg1, arg2, arg3, arg4, arg5, arg6, arg7)
|
||||
#define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
|
||||
arg5, arg6, arg7, arg8) \
|
||||
_TRACE (lvl, name, tag); \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4, arg5, \
|
||||
arg6, arg7, arg8), 0
|
||||
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
|
||||
|
||||
#define TRACE(lvl, name, tag) \
|
||||
_gpgme_debug_frame_begin (), \
|
||||
_gpgme_debug (lvl, "%s: call: %s=%p\n", \
|
||||
name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
|
||||
_gpgme_debug_frame_end (), 0
|
||||
_gpgme_debug_frame_end ()
|
||||
#define TRACE0(lvl, name, tag, fmt) \
|
||||
_gpgme_debug_frame_begin (), \
|
||||
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
|
||||
name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
|
||||
_gpgme_debug_frame_end (), 0
|
||||
_gpgme_debug_frame_end ()
|
||||
#define TRACE1(lvl, name, tag, fmt, arg1) \
|
||||
_gpgme_debug_frame_begin (), \
|
||||
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
|
||||
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), \
|
||||
_gpgme_debug_frame_end (), 0
|
||||
_gpgme_debug_frame_end ()
|
||||
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
|
||||
_gpgme_debug_frame_begin (), \
|
||||
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
|
||||
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
|
||||
arg2), _gpgme_debug_frame_end (), 0
|
||||
arg2), _gpgme_debug_frame_end ()
|
||||
#define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \
|
||||
_gpgme_debug_frame_begin (), \
|
||||
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
|
||||
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
|
||||
arg2, arg3), _gpgme_debug_frame_end (), 0
|
||||
arg2, arg3), _gpgme_debug_frame_end ()
|
||||
#define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
_gpgme_debug_frame_begin (), \
|
||||
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
|
||||
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
|
||||
arg2, arg3, arg4, arg5, arg6), \
|
||||
_gpgme_debug_frame_end (), 0
|
||||
_gpgme_debug_frame_end ()
|
||||
|
||||
#define TRACE_ERR(err) \
|
||||
err == 0 ? (TRACE_SUC ()) : \
|
||||
@ -203,53 +201,52 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
|
||||
|
||||
#define TRACE_SUC() \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: leave\n", \
|
||||
_gpgme_trace_func), _gpgme_debug_frame_end (), 0
|
||||
_gpgme_trace_func), _gpgme_debug_frame_end ()
|
||||
#define TRACE_SUC0(fmt) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||
_gpgme_trace_func), _gpgme_debug_frame_end (), 0
|
||||
_gpgme_trace_func), _gpgme_debug_frame_end ()
|
||||
#define TRACE_SUC1(fmt, arg1) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||
_gpgme_trace_func, arg1), _gpgme_debug_frame_end (), 0
|
||||
_gpgme_trace_func, arg1), _gpgme_debug_frame_end ()
|
||||
#define TRACE_SUC2(fmt, arg1, arg2) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end (), 0
|
||||
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end ()
|
||||
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \
|
||||
_gpgme_debug_frame_end (), 0
|
||||
_gpgme_debug_frame_end ()
|
||||
#define TRACE_SUC6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, arg6), \
|
||||
_gpgme_debug_frame_end (), 0
|
||||
_gpgme_debug_frame_end ()
|
||||
|
||||
#define TRACE_LOG(fmt) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag)
|
||||
#define TRACE_LOG1(fmt, arg1) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1), 0
|
||||
arg1)
|
||||
#define TRACE_LOG2(fmt, arg1, arg2) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2), 0
|
||||
arg1, arg2)
|
||||
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3), 0
|
||||
arg1, arg2, arg3)
|
||||
#define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4), 0
|
||||
arg1, arg2, arg3, arg4)
|
||||
#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4, arg5), 0
|
||||
arg1, arg2, arg3, arg4, arg5)
|
||||
#define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
|
||||
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
|
||||
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
|
||||
arg1, arg2, arg3, arg4, arg5, \
|
||||
arg6), 0
|
||||
arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
#define TRACE_LOGBUF(buf, len) \
|
||||
_gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \
|
||||
|
Loading…
Reference in New Issue
Block a user