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 2711EA0565; Mon, 23 Mar 2020 14:47:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2B8491C068; Mon, 23 Mar 2020 14:47:14 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id D20811C065 for ; Mon, 23 Mar 2020 14:47:11 +0100 (CET) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 2FFE758030F; Mon, 23 Mar 2020 09:47:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 23 Mar 2020 09:47:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=1zYHNSGgyPdwO3/fOVCRMsNN8qWGDjA/GxjUoLP2L64=; b=NogWiAs2oJQj MIn95wCMsjD4f4EE/8YXtf823ZrZSr92ZvI+ZFRG9rGo2KHLJuIjXXqPcKBYlsR9 LH5SKXDKDFNAPkW7Xcd9lF6JVTjcMXFVaLiF8Lp+O4N3Y365JOwRPuBzMrH0z5p2 OhmmdB96lrY0oHSbv55HFrczxUEoMRg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=1zYHNSGgyPdwO3/fOVCRMsNN8qWGDjA/GxjUoLP2L 64=; b=lfPnOewUjhtDuEHenDA7iOx6WK/EdTsBQH5SL/ElfMJjBLHyaGLWccfSt XfGvfsMg6BbBDXwxLF5+/8DkqP8LdRzefTGhE6k4pWfN40XnCwIrllevO9mSHj8p Yshkb2o3chql0D0xC2++UmH8ZYNbkq73HNikCY4oaAQ09IgoLnpFZ1HEfr+Xvce2 RKtz2Kfv08uW2laRx8HuHZFV6kjaL7r2iIosKgNJ2h6kzNUXmgXoRJaHohixFxbk 2bJxd6axDwV6DO1tehgUCKNl275r4CvMJXuLgrxUF3OfqcFrFBa6nx3oXpkh8vcw i4nK39qYvMjGo3HCLRV7GBL73b63Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegkedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecuff homhgrihhnpeguphgukhdrohhrghenucfkphepjeejrddufeegrddvtdefrddukeegnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrg hssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 275F5328005D; Mon, 23 Mar 2020 09:47:09 -0400 (EDT) From: Thomas Monjalon To: David Marchand Cc: dev , Vladimir Medvedkin , John McNamara , Marko Kovacevic , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Gagandeep Singh , Hemant Agrawal , Sachin Saxena , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Date: Mon, 23 Mar 2020 14:47:07 +0100 Message-ID: <1693560.8hzESeGDPO@xps> In-Reply-To: References: <20200217222654.2218926-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] devtools: forbid variable declaration inside for 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" 23/03/2020 14:40, David Marchand: > On Mon, Feb 17, 2020 at 11:27 PM Thomas Monjalon wrote: > > > > Some compilers raise an error when declaring a variable > > in the middle of a function. This is a C99 allowance. > > Even if DPDK switches globally to C99 or C11 standard, > > the coding rules are for declarations at the beginning > > of a block: > > http://doc.dpdk.org/guides/contributing/coding_style.html#local-variables > > > > This coding style is enforced by adding a check of > > the common patterns like "for (int i;" > > > > The occurrences of the checked pattern are fixed: > > 'for *(\(char\|u\?int\|unsigned\)' > > You missed size_t: > drivers/common/mlx5/mlx5_glue.c: for (size_t i = 0; i < num_actions; i++) Good catch, thanks. [..] > > --- a/devtools/checkpatches.sh > > +++ b/devtools/checkpatches.sh > > + # forbid variable declaration inside "for" loop > > + awk -v FOLDERS='.' \ > > + -v EXPRESSIONS='for *\\((char|u?int|unsigned)' \ > > + s?size_t OK > > + -v RET_ON_FAIL=1 \ > > + -v MESSAGE='Declaring a variable inside for()' \ > > + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ > > + "$1" || res=1 > > + > > Just a note, base drivers imported "as is" will probably trigger warnings. Yes, base drivers don't comply with coding rules and trigger lots of warnings.