From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] enic: disable debug traces Date: Thu, 9 Apr 2015 09:28:53 -0700 Message-ID: <20150409092853.06f127c5@urahara> References: <1428428419-25145-1-git-send-email-thomas.monjalon@6wind.com> <20150409083223.GF32147@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Adrien Mazarguil Return-path: In-Reply-To: <20150409083223.GF32147-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Thu, 9 Apr 2015 10:32:24 +0200 Adrien Mazarguil wrote: > > > > +#ifdef RTE_LIBRTE_ENIC_DEBUG > > #define ENICPMD_FUNC_TRACE() \ > > RTE_LOG(DEBUG, PMD, "ENICPMD trace: %s\n", __func__) > > +#else > > +#define ENICPMD_FUNC_TRACE() do {} while (0) > > How about defining it as (void)0 instead of an empty do/while block? > > Doing so will prevent warnings if this macro happens to be used in an > expression. RTE_LOG() supports it. I kind of like the Linux printk trick since it then preserves the format checking even if compiled out. /* * Dummy printk for disabled debugging statements to use whilst maintaining * gcc's format and side-effect checking. */ static inline __printf(1, 2) int no_printk(const char *fmt, ...) { return 0; } /* pr_devel() should produce zero code unless DEBUG is defined */ #ifdef DEBUG #define pr_devel(fmt, ...) \ printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #else #define pr_devel(fmt, ...) \ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) #endif