From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 68B0D6CB7 for ; Wed, 5 Oct 2016 04:31:16 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 04 Oct 2016 19:31:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,446,1473145200"; d="scan'208";a="768943217" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by FMSMGA003.fm.intel.com with ESMTP; 04 Oct 2016 19:31:13 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.164]) by IRSMSX102.ger.corp.intel.com ([169.254.2.198]) with mapi id 14.03.0248.002; Wed, 5 Oct 2016 03:31:12 +0100 From: "De Lara Guarch, Pablo" To: Adrien Mazarguil CC: "dev@dpdk.org" , "Doherty, Declan" Thread-Topic: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 Thread-Index: AQHSGD/aV4rHUlHYI0eJwr3tmbq/aKCM5O+AgAP3GnCAAM17gIAHb//Q Date: Wed, 5 Oct 2016 02:31:12 +0000 Message-ID: References: <1474926635-13290-1-git-send-email-pablo.de.lara.guarch@intel.com> <20160927074521.GY17252@6wind.com> <20160930083359.GU17252@6wind.com> In-Reply-To: <20160930083359.GU17252@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTViYzJhMTgtMTMxMS00YjQwLWE3M2MtNjg2OTE4MGRkOTZhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjVjbStMTjdmaEJDZUhwSkRLRmlXMDdnWXBvK0FDZHRZbkZ4cmdlXC9yTEhZPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 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, 05 Oct 2016 02:31:17 -0000 Hi Adrien, > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Friday, September 30, 2016 1:34 AM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org; Doherty, Declan > Subject: Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 >=20 > On Thu, Sep 29, 2016 at 07:30:31PM +0000, De Lara Guarch, Pablo wrote: > > > -----Original Message----- > > > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > > > Sent: Tuesday, September 27, 2016 12:45 AM > > > To: De Lara Guarch, Pablo > > > Cc: dev@dpdk.org; Doherty, Declan > > > Subject: Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 > > > > > > On Mon, Sep 26, 2016 at 10:50:35PM +0100, Pablo de Lara wrote: > > > > This commit fixes following build error, which happens in SUSE 11 S= P2, > > > > with gcc 4.5.1: > > > > > > > > In file included from lib/librte_cryptodev/rte_cryptodev.c:71:0: > > > > lib/librte_cryptodev/rte_cryptodev_pmd.h:76:7: > > > > error: flexible array member in otherwise empty struct > > > > > > > > Fixes: 347a1e037fd3 ("lib: use C99 syntax for zero-size arrays") > > > > > > > > Signed-off-by: Pablo de Lara > > > > > > Hmm, this error message does not seem related to your patch. Assuming= a > > > similar error is caused by the original code, I think there is a more > > > important issue as the struct should not be empty. Can you check the > > > error? > > > > Well, I don't really understand what is the difference between array[] = and > array[0], > > I thought both were the same, but some compilers only accept the latter= . >=20 > Before array[] got standardized by C99, a common trick was to use array[0= ], > in a sense they are similar except for this one case: a struct with a sin= gle > array[] field is explicitly not allowed in C99 since it causes the struct= ure > to be empty (this syntax only provides an alignment constraint for what > follows in case padding is required), no such problem with array[0] which > although nonstandard, is an accepted behavior, sizeof(struct foo) may yie= ld > 0 without complaint. >=20 > > In any case, the struct will not be empty, as there are other fields, t= hat are > not variable sized. > > > > I saw that in your patch you made these two changes (among others): > > > > diff --git a/lib/librte_cryptodev/rte_cryptodev.h > b/lib/librte_cryptodev/rte_cryptodev.h > > index affbdec..1e30a19 100644 > > --- a/lib/librte_cryptodev/rte_cryptodev.h > > +++ b/lib/librte_cryptodev/rte_cryptodev.h > > @@ -759,7 +759,7 @@ struct rte_cryptodev_sym_session { > > } __rte_aligned(8); > > /**< Public symmetric session details */ > > > > - char _private[0]; > > + char _private[]; > > /**< Private session material */ > > }; > > > > diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h > b/lib/librte_cryptodev/rte_cryptodev_pmd.h > > index 7d049ea..42e7b79 100644 > > --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h > > +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h > > @@ -71,7 +71,7 @@ struct rte_cryptodev_session { > > struct rte_mempool *mp; > > } __rte_aligned(8); > > > > - char _private[0]; > > + __extension__ char _private[0]; > > }; > > > > So I would expect the same change in both, as they are almost identical= , > > but you took different approaches (do you know why? I would like to kno= w > :)) >=20 > Yes, this was done to address the exact same error (probably with the sam= e > old GCC version (4.4.7 perhaps?)), hence my surprise to see it fixed once > again according to your commit log, I think your only mistake was to past= e > the error message for the wrong header in there (rte_cryptodev_pmd.h > instead > of rte_cryptodev.h), nothing wrong with your patch besides this. Ohhh, all right! I understand now. Will send a v2 with the commit message f= ixed. Thanks! Pablo >=20 > > Basically, I noticed that gcc 4.5 doesn't complain when using your seco= nd > approach, > > that's why I changed it. >=20 > For the record GCC wrongly thinks the structure is empty because a unname= d > struct field is declared inside. Before C11 such declarations only create= d a > new type that did not occupy any space and not an actual field, hence why= it > complains when faced with [] instead of the well-behaved [0]. >=20 > In this particular case it's a parsing error fixed in subsequent GCC > versions, the unnamed struct actually uses some space otherwise it would > have crashed during non-regression testing (right?) >=20 > -- > Adrien Mazarguil > 6WIND