From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6AF07A04FA; Thu, 6 Feb 2020 07:44:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 369911C001; Thu, 6 Feb 2020 07:44:42 +0100 (CET) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id 9F5F61BFAA for ; Thu, 6 Feb 2020 07:44:39 +0100 (CET) Received: by mail-lf1-f65.google.com with SMTP id n25so3292095lfl.0 for ; Wed, 05 Feb 2020 22:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l213dkCU/FdwVGhbbD3agoLOcLpWMuN2wM7qnDC+fVM=; b=nJ/6pMCyv+CrT/+WZJCdTNIkl7e+q5s+FYQxTSytZ0z9rrDtdcoZ5y1Ss9jpyP/XkL FsdA74wT2vDBaAqYkFioCp+mwCf8DIdJn7tmKMu4Ai8TGCjkcu+buWGip6vLHFebtX6X mG9v4Xy83u7pkFf4PE4IkoqcSo81CpvHsBEE6uWxce0IzpCTLs0cukfZq5hue2fo/vtk 2sICcW+s0gJVoKYJTQ6no6esi4LTP6fuj4NLXUbfBnHGlMkcq3E+gn0MkErtqye9QSy6 dwEx3Q9oXGJ+wfADUNAmqR5wlIGcK3xl84opOxsAbO1tkE2s9CKguduQVsK9cDySHuxU WjUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l213dkCU/FdwVGhbbD3agoLOcLpWMuN2wM7qnDC+fVM=; b=q/3X8arrcdL4+peSKyCj57z4GiPDjxt1hGls7r0j3itjQpSGcgF6vm+L072+Lqko2j 9lk1s/es2WZqignlfj6tu7BK24ZPfVndeOweA9aUIRbfaQDvWWjWLpSgWO/b8Xth1ftU +sAbxVQvBQuyXDMfwPsJK7GhBEiCl8sIkFFK9PqQBJFTEQj9HqKNX7Hp47Ae0ObzLNet FUQHl41NaiDoknzSqG4lfiMc67aPkqUM8AKeGcIK+BIAVTnwByTY6034RJUl5HHRGmRk 2xOvi+9o6kUBTTxpNDKCyYkZRGxaEsyQqiz53PGJR8sGw5BPKA/Cq4x85EopcS1JNuIH /Gjw== X-Gm-Message-State: APjAAAXp2/GdxAeTtMTpLZ6VFC5OdL/ZkLSktzV8K3LQOZ46kdUVwcDX QbX6MDP5vAbK2XGBhR5J+gB8mosljSU= X-Google-Smtp-Source: APXvYqz2vcFgEf6XI8R6VlMh6OZGm/TMhbEiWlV7PMa5gLgik/ssp77Exr1wtsXcLmw3bYTaeA8U7Q== X-Received: by 2002:ac2:482c:: with SMTP id 12mr916987lft.163.1580971478993; Wed, 05 Feb 2020 22:44:38 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id o19sm939669lji.54.2020.02.05.22.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:38 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk Date: Thu, 6 Feb 2020 09:44:20 +0300 Message-Id: <20200206064426.45697-2-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/7] eal: introduce portable format attribute X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When using __attribute__((format(...)) on functions, GCC on Windows assumes MS-specific format string by default, even if the underlying stdio implementation is ANSI-compliant (either MS Unicersal CRT or MinGW implementation). Wrap attribute into a macro that forces GNU-specific format string when using GCC. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/common/include/rte_common.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 4b5f3a31f..2f086bb9c 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -89,6 +89,21 @@ typedef uint16_t unaligned_uint16_t; */ #define RTE_SET_USED(x) (void)(x) +/** + * Check format string and its arguments at compile-time. + * + * GCC on Windows assumes MS-specific format string by default, + * even if the underlying stdio implementation is ANSI-compliant, + * so this must be overridden. + */ +#if defined(RTE_TOOLCHAIN_GCC) +#define __rte_format(archetype, format_index, first_arg) \ + __attribute__((format(gnu_##archetype, format_index, first_arg))) +#else +#define __rte_format(archetype, format_index, first_arg) \ + __attribute__((format(archetype, format_index, first_arg))) +#endif + #define RTE_PRIORITY_LOG 101 #define RTE_PRIORITY_BUS 110 #define RTE_PRIORITY_CLASS 120 -- 2.25.0