From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by dpdk.org (Postfix) with ESMTP id 7314C5A43 for ; Thu, 9 Apr 2015 18:29:00 +0200 (CEST) Received: by paboj16 with SMTP id oj16so154767977pab.0 for ; Thu, 09 Apr 2015 09:28:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=a3V7BQduWl6RXU7yAFsgXWCI6mM3O+5TA8/vCIEIZ+Q=; b=lqowuxw70hUG/6O5dbN3GT5NcPcTv/v/oQtYyHj9/vo6xKMH/Hk9DIq+4NQmjsXlPc VxqVO3yNBUHX5bymp+sxoCTkHJ1wjh3pdoYUPlxURq+DkMn71KUMMBfiiqTxL+E9m3z+ dvAhsPdRqZIJLV/rEEhhHFA0x52pojMFx2azGu2a3ql5Q2wi6gNq61o42PVz8M3agcwM SjcBHnE8Gp96LAcIyn5YZOsjTVRZb9vENa0P855IGWaA1LfNew9mYAX3zeDdfeSvmb/q e3F1rfDia7+mYEYgVeXq8jl1gzxY/MpHpK38p9m2ykexfFHlNTiejJr13Fzn0mLlprwl m+og== X-Gm-Message-State: ALoCoQlx2FNl8KUtkVcQQK5VZSBd3yDQasws8alIxls1+PWx4ZO09Muvw0lM/uMurGXs8JewBBVE X-Received: by 10.70.131.15 with SMTP id oi15mr57202440pdb.161.1428596939643; Thu, 09 Apr 2015 09:28:59 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id rp10sm1037886pbc.3.2015.04.09.09.28.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 09:28:59 -0700 (PDT) Date: Thu, 9 Apr 2015 09:28:53 -0700 From: Stephen Hemminger To: Adrien Mazarguil Message-ID: <20150409092853.06f127c5@urahara> In-Reply-To: <20150409083223.GF32147@6wind.com> 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@dpdk.org Subject: Re: [dpdk-dev] [PATCH] enic: disable debug traces X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Apr 2015 16:29:00 -0000 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