From patchwork Sat Nov 5 10:24:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 13033018 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B126DC433FE for ; Sat, 5 Nov 2022 10:42:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orGc6-0004UF-Uh; Sat, 05 Nov 2022 06:41:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orGc5-0004Tb-I4; Sat, 05 Nov 2022 06:41:21 -0400 Received: from smtp.mail.uni-mannheim.de ([2001:7c0:2900:60::869b:6050]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orGbq-00036i-3t; Sat, 05 Nov 2022 06:41:21 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.mail.uni-mannheim.de (Postfix) with ESMTP id 0711C100CFE; Sat, 5 Nov 2022 11:25:20 +0100 (CET) X-Virus-Scanned: amavisd-new at uni-mannheim.de Received: from smtp.mail.uni-mannheim.de ([134.155.96.80]) by localhost (mail-r83.rz.uni-mannheim.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g6E-RqwaLwB3; Sat, 5 Nov 2022 11:25:19 +0100 (CET) Received: from bss11.bib.uni-mannheim.de (unknown [IPv6:2001:7c0:2900:8024::869b:24a1]) by smtp.mail.uni-mannheim.de (Postfix) with ESMTPS id DFDED100C07; Sat, 5 Nov 2022 11:25:19 +0100 (CET) Received: from stweil by bss11.bib.uni-mannheim.de with local (Exim 4.94.2) (envelope-from ) id 1orGMZ-001pcB-Kh; Sat, 05 Nov 2022 11:25:19 +0100 To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: Stefan Hajnoczi , Laurent Vivier , Stefan Weil , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 4/4] libvhost-user: Add format attribute to local function vu_panic Date: Sat, 5 Nov 2022 11:24:48 +0100 Message-Id: <20221105102448.436469-5-sw@weilnetz.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221105102448.436469-1-sw@weilnetz.de> References: <20221105102448.436469-1-sw@weilnetz.de> MIME-Version: 1.0 Received-SPF: none client-ip=2001:7c0:2900:60::869b:6050; envelope-from=stweil@bss11.bib.uni-mannheim.de; helo=smtp.mail.uni-mannheim.de X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_NONE=0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Reply-to: Stefan Weil X-Patchwork-Original-From: Stefan Weil via From: Stefan Weil Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Stefan Weil Reviewed-by: Marc-André Lureau Message-Id: <20220422070144.1043697-4-sw@weilnetz.de> Signed-off-by: Laurent Vivier --- subprojects/libvhost-user/libvhost-user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 80f9952e71..d6ee6e7d91 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -45,6 +45,17 @@ #include "libvhost-user.h" /* usually provided by GLib */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) +#if !defined(__clang__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 4) +#define G_GNUC_PRINTF(format_idx, arg_idx) \ + __attribute__((__format__(gnu_printf, format_idx, arg_idx))) +#else +#define G_GNUC_PRINTF(format_idx, arg_idx) \ + __attribute__((__format__(__printf__, format_idx, arg_idx))) +#endif +#else /* !__GNUC__ */ +#define G_GNUC_PRINTF(format_idx, arg_idx) +#endif /* !__GNUC__ */ #ifndef MIN #define MIN(x, y) ({ \ typeof(x) _min1 = (x); \ @@ -151,7 +162,7 @@ vu_request_to_string(unsigned int req) } } -static void +static void G_GNUC_PRINTF(2, 3) vu_panic(VuDev *dev, const char *msg, ...) { char *buf = NULL;