Page MenuHome GnuPG

gpgme has noisy warnings in debug.h
Closed, ResolvedPublic

Description

working from the current git head of gpgme (4746c5c9e2dd9a3ee471a429c19bc1f7fd1d07db), i see many warnings from debug.h, when using gcc (Debian 8.3.0-6) 8.3.0. One small example:

In file included from data-compat.c:36:
debug.h: In function '_trace_err':
debug.h:138:45: warning: zero-length gnu_printf format string [-Wformat-zero-length]
     _gpgme_debug (lvl, 3, func, NULL, NULL, "");
                                             ^~
In file included from signers.c:34:
debug.h: In function '_trace_err':
debug.h:138:45: warning: zero-length gnu_printf format string [-Wformat-zero-length]
     _gpgme_debug (lvl, 3, func, NULL, NULL, "");
                                             ^~
signers.c: In function 'gpgme_signers_clear':
signers.c:59:49: warning: zero-length gnu_printf format string [-Wformat-zero-length]
   TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx, "");
                                                 ^~
debug.h:126:19: note: in definition of macro 'TRACE'
                   __VA_ARGS__);                                         \
                   ^~~~~~~~~~~
signers.c: In function 'gpgme_signers_add':
signers.c:92:14: warning: zero-length gnu_printf format string [-Wformat-zero-length]
   TRACE_SUC ("");
              ^~
debug.h:181:19: note: in definition of macro 'TRACE_SUC'
                   __VA_ARGS__);                                         \
                   ^~~~~~~~~~~

they seem to have been introduced between 1.12 and 1.13 (probably in 5857491a2aa7d4975100d90f1ad62c08aa345e3e).

Please clean these up! they make it hard to see whether there are any real warnings we should be concerned about.

Event Timeline

aheinecke triaged this task as Normal priority.
aheinecke added a subscriber: aheinecke.

Thanks for the report. This is annoying me, too when doing release builds.

The weird thing is that in "maintainer-mode" the warnings are disabled so we don't see them during development.

I find it strange that we develop with more relaxed warnings then when we release. So my change here would be to unify the compiler flags so that release builds use the same flags as development builds. This would remove the warning here, but I would like to get werner's OK before changing this.

The thing is that that I accidentally added the -Wno-* flags only in maintainer-mode as they were -Wmore-strict-warning-flags. One reason for using more strict warnings in maintainer mode is to allow building with older gcc versions without having to test for the availability of the warning flags.

That makes sense to me. So I've now moved the -Wno flags out of the maintainer mode conditional but left the parts adding warnings in the maintainer mode conditional.

Thanks for the prompt action here. Some build environments (e.g. distro builds) might ask for additional compiler warnings in the user-supplied CFLAGS, but i suppose those build environments that enable the warnings deserve what they get.

That said, if building with -Wno-format-truncation during --maintainer-mode means that maintainer mode builds are noisy, then it seems like we ought to clear those warnings anyway by avoiding that behavior, so that other warnings are more visible.