From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f53.google.com (mail-qg0-f53.google.com [209.85.192.53]) by dpdk.org (Postfix) with ESMTP id AC9465A6F for ; Wed, 10 Jun 2015 02:33:56 +0200 (CEST) Received: by qgg3 with SMTP id 3so11193402qgg.2 for ; Tue, 09 Jun 2015 17:33:56 -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=FHAM80BJDd45gbA9tNTqm6DacXubF2Rh6jzAGkHe/5A=; b=MaQYRFSQSFT4JpFE6B2v2HrejVH4WMRnq+KiCFxx+x3Ld3bRsmrBXemFW7NmUsI7Vp G//GBd7Ho71CGX/2Lk2KRO9J6PXrVN9MTQKhSXQP4oB0II4Mttx0mhY2Rw0aaHaGApT2 kDq+Lge1bMQORypx0adUfirSBs3nc6i60GHSGKs+MBd3cU3RPHZk5aP8uAb742Z2VB5N jRYpb02UqjB2q2bsa1GSZ9O3G8u6JMzO2YJHbaQ1u62wix2I9M1Q9awCMzIWae41614u ZQ2GRg6V504+qnCGIVPw9wxjz0e7P5hG64xdBfADOwaFcnNTFXTekWrUgO+fBa00rluG o0Ow== X-Gm-Message-State: ALoCoQlM/vbyNVtf9x9HjDPuRLvAWX8fjl83qxq36E0sXIVumUy6k9hvjyJ+z3xkBazGoceMSfFa X-Received: by 10.55.16.200 with SMTP id 69mr749814qkq.98.1433896436304; Tue, 09 Jun 2015 17:33:56 -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 p90sm3444697qkp.27.2015.06.09.17.33.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 17:33:56 -0700 (PDT) Date: Tue, 9 Jun 2015 17:33:58 -0700 From: Stephen Hemminger To: Bruce Richardson Message-ID: <20150609173358.267e3281@urahara> In-Reply-To: <20150608105810.GC3996@bricha3-MOBL3> References: <1433520077-11234-1-git-send-email-bruce.richardson@intel.com> <19910784.6F5piXXB0d@xps13> <20150608105810.GC3996@bricha3-MOBL3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] examples/distributor: fix missing "; " in debug macro 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: Wed, 10 Jun 2015 00:33:56 -0000 On Mon, 8 Jun 2015 11:58:10 +0100 Bruce Richardson wrote: > On Fri, Jun 05, 2015 at 10:45:04PM +0200, Thomas Monjalon wrote: > > 2015-06-05 17:01, Bruce Richardson: > > > The macro to turn on additional debug output when the app was compiled > > > with "-DDEBUG" was missing a ";". > > > > It shows that such dead code is almost never tested. > > It would be saner if this command would return no result: > > git grep 'ifdef.*DEBUG' examples > > examples/distributor/main.c:#ifdef DEBUG > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG > > examples/l3fwd-acl/main.c:#ifdef L3FWDACL_DEBUG > > examples/packet_ordering/main.c:#ifdef DEBUG > > examples/vhost/main.c:#ifdef DEBUG > > examples/vhost/main.h:#ifdef DEBUG > > examples/vhost_xen/main.c:#ifdef DEBUG > > examples/vhost_xen/main.h:#ifdef DEBUG > > > > There is no good reason to not use CONFIG_RTE_LOG_LEVEL to trigger debug build. > > > I agree and disagree. > > I agree it would be good if we had a standard way of setting up > a DEBUG build that would make it easier to test and pick up on this sort of things. > > I disagree that the compile time log level is the way to do this. The log level > at compile time specifies the default log level only, the actual log level is > controllable at runtime. Having the default log level also affect what kind of > build is done, e.g. with -O0 rather than -O3, introduces an unnecessary dependency. > Setting the default log level to 5 and changing it to 9 at runtime should be > the same as setting the default to 9. > > /Bruce One good way is to use something like: #ifdef DEBUG #define LOG_DEBUG(log_type, fmt, args...) do { \ - RTE_LOG(DEBUG, log_type, fmt, ##args) \ + RTE_LOG(DEBUG, log_type, fmt, ##args); \ } while (0) #else #define LOG_LEVEL RTE_LOG_INFO #define LOG_DEBUG(log_type, fmt, args...) if (0) { \ RTE_LOG(DEBUG, log_type, fmt, ##args); \ } else #endif