From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 567E63B5 for ; Wed, 4 Mar 2015 11:26:39 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 04 Mar 2015 02:23:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,686,1418112000"; d="scan'208";a="693760738" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga002.jf.intel.com with ESMTP; 04 Mar 2015 02:26:26 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.117]) by IRSMSX101.ger.corp.intel.com ([163.33.3.153]) with mapi id 14.03.0195.001; Wed, 4 Mar 2015 10:26:24 +0000 From: "Ananyev, Konstantin" To: "Richardson, Bruce" , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH] ring: cleanup file-local macros at end-of-file Thread-Index: AQHQVfW1dyBiplJ+ZEKkOrEKQNp5VJ0MHlYAgAAApnA= Date: Wed, 4 Mar 2015 10:26:24 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258213F3C63@irsmsx105.ger.corp.intel.com> References: <1425400717-24322-1-git-send-email-bruce.richardson@intel.com> <6979759.vFaJhNqs1F@xps13> <20150304102234.GD1468@bricha3-MOBL3> In-Reply-To: <20150304102234.GD1468@bricha3-MOBL3> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] ring: cleanup file-local macros at end-of-file 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, 04 Mar 2015 10:26:39 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson > Sent: Wednesday, March 04, 2015 10:23 AM > To: Thomas Monjalon > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] ring: cleanup file-local macros at end-of= -file >=20 > On Tue, Mar 03, 2015 at 10:03:45PM +0100, Thomas Monjalon wrote: > > 2015-03-03 16:38, Bruce Richardson: > > > The ENQUEUE_PTRS and DEQUEUE_PTRS macros defined in rte_ring.h are > > > not meant to be global and are not prefixed with the RTE_ prefix. > > > Therefore undef the macros at end of file to avoid pollution of the > > > global namespace, in case ends apps end up wanting to reuse those nam= es. > > > > > > Signed-off-by: Bruce Richardson > > > --- > > > lib/librte_ring/rte_ring.h | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h > > > index bdf69b7..0d35648 100644 > > > --- a/lib/librte_ring/rte_ring.h > > > +++ b/lib/librte_ring/rte_ring.h > > > @@ -1232,6 +1232,10 @@ rte_ring_dequeue_burst(struct rte_ring *r, voi= d **obj_table, unsigned n) > > > return rte_ring_mc_dequeue_burst(r, obj_table, n); > > > } > > > > > > +/* undef un-prefixed macros which are local to this file */ > > > +#undef ENQUEUE_PTRS > > > +#undef DEQUEUE_PTRS > > > + > > > > Thanks for trying to clean-up things. > > Note that if an application is using this macro name, it will be destro= yed > > when including rte_ring.h. > > Globally, DPDK namespace is awful and I hope we will be able to improve= it. > > > Only if they are defining such a macro before including rte_ring.h, which= I would > expect to be an edge case. Also, in such a case, the compiler/preprocesso= r will > give an error at the duplicate macro definition stage, and the simple fix= is to > reorder the header file inclusion to avoid problems i.e. no changing of d= pdk > required. > I suppose a better fix to go along with this is to RTE-prefix the macros.= I'll > see about doing a V2. Why not just to rename it to __RTE_RING_ENQUEUE_PTRS__ or something, and put in the comments that it is for internal usage? Konstantin >=20 > /Bruce