From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 8E3234B79 for ; Fri, 15 Apr 2016 09:31:53 +0200 (CEST) Received: from was59-1-82-226-113-214.fbx.proxad.net ([82.226.113.214] helo=[192.168.0.10]) by mail.droids-corp.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1aqyG6-000501-2a; Fri, 15 Apr 2016 09:33:42 +0200 To: "Wiles, Keith" , "dev@dpdk.org" References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> <1460629199-32489-1-git-send-email-olivier.matz@6wind.com> <1460629199-32489-11-git-send-email-olivier.matz@6wind.com> <2D283F2F-17D1-4022-B95E-B1CF8526F526@intel.com> Cc: "Richardson, Bruce" , "stephen@networkplumber.org" From: Olivier Matz Message-ID: <571098E1.8090905@6wind.com> Date: Fri, 15 Apr 2016 09:31:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <2D283F2F-17D1-4022-B95E-B1CF8526F526@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 10/36] mempool: use the list to iterate the mempool elements 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: Fri, 15 Apr 2016 07:31:53 -0000 Hi, On 04/14/2016 05:33 PM, Wiles, Keith wrote: >> >> static void >> -txq_mp2mr_mbuf_check(void *arg, void *start, void *end, >> - uint32_t index __rte_unused) >> +txq_mp2mr_mbuf_check(struct rte_mempool *mp, void *arg, void *obj, >> + __rte_unused uint32_t index) > > I have seen this use of __rte_unused or attributes attached to variables and structures in couple different ways. > > I have seen the placement of the attribute after and before the variable I prefer the attribute to be after, but could adapt I hope. > Do we have a rule about where the attribute is put in this case and others. I have seen the attributes for structures are always at the end of the structure, which is some cases it may not compile in other places. > > I would like to suggest we place the attributes at the end of structure e.g. __rte_cached_aligned and I would like to see the __rte_unused after the variable as a style in the code. I agree the __rte_unused shouldn't have moved in this patch. About the default place of attributes, I've seen an exemple where putting it at the end didn't what I expected: struct { int foo; } __rte_cache_aligned; The expected behavior is to define a structure which is cache aligned. But if "rte_memory.h" is not included, it will define a structure which is not cache aligned, and a global variable called __rte_cache_aligned, without any compiler warning. The gcc doc gives some hints about where to place the attributes: https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html Given its length, I'm not sure the dpdk coding rules should contain anything more than "refer to gcc documentation" ;) Regards, Olivier