aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-06-08 09:08:08 +0000
committerWerner Koch <[email protected]>2015-06-08 09:08:08 +0000
commit8b9f84828cd04a7dab37e219123edc1905da8e6b (patch)
treedbec79899dd1d8ed9723a2ac5a164086bbc1a6a3 /src/debug.c
parentFix test suite for GnuPG 2.1 which uses pubring.kbx. (diff)
downloadgpgme-8b9f84828cd04a7dab37e219123edc1905da8e6b.tar.gz
gpgme-8b9f84828cd04a7dab37e219123edc1905da8e6b.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--src/debug.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/debug.c b/src/debug.c
index ca0bb21a..292db555 100644
--- a/src/debug.c
+++ b/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;
}