mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-01-11 16:51:28 +00:00
Merge pull request #175 from jnpkrn/format-annotations
Format annotations
This commit is contained in:
commit
242a07ebc2
@ -488,6 +488,12 @@ for j in $WARNLIST; do
|
||||
fi
|
||||
done
|
||||
|
||||
# warnings suppression
|
||||
if test x"$GCC" = xyes && cc_supports_flag -Wsuggest-attribute=format; then
|
||||
AC_DEFINE([HAVE_GCC_SUGGEST_ATTRIBUTE_FORMAT], [],
|
||||
[gcc supports -Wsuggest-attribute=format])
|
||||
fi
|
||||
|
||||
# --- coverage ---
|
||||
if test "x${enable_coverage}" = xyes && \
|
||||
cc_supports_flag -ftest-coverage && \
|
||||
|
||||
@ -296,7 +296,8 @@ void qb_log_from_external_source(const char *function,
|
||||
uint8_t priority,
|
||||
uint32_t lineno,
|
||||
uint32_t tags,
|
||||
...);
|
||||
...)
|
||||
__attribute__ ((format (printf, 3, 7)));
|
||||
|
||||
/**
|
||||
* Get or create a callsite at the give position.
|
||||
@ -323,7 +324,8 @@ void qb_log_from_external_source_va(const char *function,
|
||||
uint8_t priority,
|
||||
uint32_t lineno,
|
||||
uint32_t tags,
|
||||
va_list ap);
|
||||
va_list ap)
|
||||
__attribute__ ((format (printf, 3, 0)));
|
||||
|
||||
/**
|
||||
* This is the function to generate a log message if you want to
|
||||
|
||||
@ -172,6 +172,12 @@ _cs_matches_filter_(struct qb_log_callsite *cs,
|
||||
* @param[in] cs Callsite containing format to use
|
||||
* @param[in] ap Variable arguments for format
|
||||
*/
|
||||
#ifdef HAVE_GCC_SUGGEST_ATTRIBUTE_FORMAT
|
||||
/* suppress suggestion that we currently can do nothing better about
|
||||
as the format specification is hidden in cs argument */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
|
||||
#endif
|
||||
static inline void
|
||||
cs_format(char *str, struct qb_log_callsite *cs, va_list ap)
|
||||
{
|
||||
@ -188,6 +194,9 @@ cs_format(char *str, struct qb_log_callsite *cs, va_list ap)
|
||||
str[len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_GCC_SUGGEST_ATTRIBUTE_FORMAT
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
void
|
||||
qb_log_real_va_(struct qb_log_callsite *cs, va_list ap)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user