From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH] ethdev: add function name to log message Date: Fri, 12 Oct 2018 11:45:01 +0100 Message-ID: <696e6f90-3d0c-acd4-d72d-bbebe1ff6f54@intel.com> References: <20181011175940.6800-1-stephen@networkplumber.org> <98717fc3-c3dd-cc4f-e5ff-b5310e47d6ee@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, Adrien Mazarguil , Gaetan Rivet To: Stephen Hemminger , thomas@monjalon.net Return-path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id E7A451B4EC for ; Fri, 12 Oct 2018 12:45:04 +0200 (CEST) In-Reply-To: <98717fc3-c3dd-cc4f-e5ff-b5310e47d6ee@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/12/2018 11:42 AM, Ferruh Yigit wrote: > On 10/11/2018 6:59 PM, Stephen Hemminger wrote: >> @@ -161,8 +161,9 @@ extern "C" { >> >> extern int rte_eth_dev_logtype; >> >> -#define RTE_ETHDEV_LOG(level, ...) \ >> - rte_log(RTE_LOG_ ## level, rte_eth_dev_logtype, "" __VA_ARGS__) >> +#define RTE_ETHDEV_LOG(level, fmt, ...) \ >> + rte_log(RTE_LOG_ ## level, rte_eth_dev_logtype, \ >> + "%s():" fmt, __func__, ## __VA_ARGS__) > > +1 to adding function name, but > > failsafe is giving build error [1] with clang because of ## usage [2], that is > why I add this as ` "" __VA_ARGS__` at first place but you can't do this trick > if __VA_ARGS__ used after fmt. > > I am not aware of a solution for this, __VA_OPT__(,) also didn't worked with clang. +cc Adrien & Gaetan, I saw Adrien put some "workaround" to this for mlx5 > > > [1] > .../build/include/rte_ethdev.h:166:26: error: token pasting of ',' and > __VA_ARGS__ is a GNU extension [-Werror,-Wgnu-zero-variadic-macro-arguments] > "%s():" fmt, __func__, ## __VA_ARGS__) > ^ > > [2] > This seems because of "-pedantic" argument driver uses, and other PMDs using > "-pedantic", like mlx, will have same error although they are disable by > default and error not observed in default build. >