From bd79297709e78809b023614330ba61b15b70b3f1 Mon Sep 17 00:00:00 2001 From: Guoye Zhang Date: Wed, 27 Oct 2021 11:04:10 -0700 Subject: [PATCH] Adopt __printflike macro for -Wformat-nonliteral --- lib/nghttp2_helper.h | 4 ++++ lib/nghttp2_session.c | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/nghttp2_helper.h b/lib/nghttp2_helper.h index b1f18ce5..adf80515 100644 --- a/lib/nghttp2_helper.h +++ b/lib/nghttp2_helper.h @@ -35,6 +35,10 @@ #include #include "nghttp2_mem.h" +#ifndef __printflike +# define __printflike(fmtarg, firstvararg) +#endif + #define nghttp2_min(A, B) ((A) < (B) ? (A) : (B)) #define nghttp2_max(A, B) ((A) > (B) ? (A) : (B)) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 36f1179f..6fa1bf14 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -147,6 +147,7 @@ static int check_ext_type_set(const uint8_t *ext_types, uint8_t type) { return (ext_types[type / 8] & (1 << (type & 0x7))) > 0; } +__printflike(3, 4) static int session_call_error_callback(nghttp2_session *session, int lib_error_code, const char *fmt, ...) {