DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Compilation errors in drivers/event/opdl/
@ 2018-01-20  5:18 Patil, Harish
  2018-01-20  8:44 ` Thomas Monjalon
  2018-01-20  8:56 ` Jerin Jacob
  0 siblings, 2 replies; 7+ messages in thread
From: Patil, Harish @ 2018-01-20  5:18 UTC (permalink / raw)
  To: liang.j.ma, peter.mccarthy; +Cc: dev

Hi,

I am seeing below compilation errors in drivers/event/opdl/, this is with
cloned latest DPDK (git clone http://dpdk.org/git/dpdk).

..
..
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c: In function ‘opdl_xstats_get_names’:
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in
C99 mode
  for (uint32_t j = 0; j < max_num_port_xstat; j++) {
  ^
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c:89:2: note: use option -std=c99 or -std=gnu99 to compile your code
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c: In function ‘opdl_xstats_get’:
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c:124:2: error: ‘for’ loop initial declarations are only allowed in
C99 mode
  for (uint32_t i = 0; i < n; i++) {
  ^
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c: In function ‘opdl_xstats_get_by_name’:
/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
ts.c:145:2: error: ‘for’ loop initial declarations are only allowed in
C99 mode
  for (uint32_t i = 0; i < max_index; i++) {
..
..
  ^

Thanks,
Harish






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Compilation errors in drivers/event/opdl/
  2018-01-20  5:18 [dpdk-dev] Compilation errors in drivers/event/opdl/ Patil, Harish
@ 2018-01-20  8:44 ` Thomas Monjalon
  2018-01-21 17:34   ` Stephen Hemminger
  2018-01-20  8:56 ` Jerin Jacob
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2018-01-20  8:44 UTC (permalink / raw)
  To: Patil, Harish, liang.j.ma, peter.mccarthy, jerin.jacob; +Cc: dev, ferruh.yigit

20/01/2018 06:18, Patil, Harish:
> Hi,
> 
> I am seeing below compilation errors in drivers/event/opdl/, this is with
> cloned latest DPDK (git clone http://dpdk.org/git/dpdk).
> 
> ..
> ..
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c: In function ‘opdl_xstats_get_names’:
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in
> C99 mode
>   for (uint32_t j = 0; j < max_num_port_xstat; j++) {
>   ^

My compiler does not raise this error.
What is your compiler?

Anyone to fix it QUICKLY please? today?

Harish, do you think we should revert if not fixed?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Compilation errors in drivers/event/opdl/
  2018-01-20  5:18 [dpdk-dev] Compilation errors in drivers/event/opdl/ Patil, Harish
  2018-01-20  8:44 ` Thomas Monjalon
@ 2018-01-20  8:56 ` Jerin Jacob
  2018-01-22 18:38   ` Patil, Harish
  1 sibling, 1 reply; 7+ messages in thread
From: Jerin Jacob @ 2018-01-20  8:56 UTC (permalink / raw)
  To: Patil, Harish; +Cc: liang.j.ma, peter.mccarthy, dev

-----Original Message-----
> Date: Sat, 20 Jan 2018 05:18:30 +0000
> From: "Patil, Harish" <Harish.Patil@cavium.com>
> To: "liang.j.ma@intel.com" <liang.j.ma@intel.com>,
>  "peter.mccarthy@intel.com" <peter.mccarthy@intel.com>
> CC: "dev@dpdk.org" <dev@dpdk.org>
> Subject: [dpdk-dev] Compilation errors in drivers/event/opdl/
> 
> [This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
> 
> Hi,
> 
> I am seeing below compilation errors in drivers/event/opdl/, this is with
> cloned latest DPDK (git clone http://dpdk.org/git/dpdk).
> 
> ..
> ..
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c: In function ‘opdl_xstats_get_names’:
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in
> C99 mode
>   for (uint32_t j = 0; j < max_num_port_xstat; j++) {
>   ^
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c:89:2: note: use option -std=c99 or -std=gnu99 to compile your code
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c: In function ‘opdl_xstats_get’:
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c:124:2: error: ‘for’ loop initial declarations are only allowed in
> C99 mode
>   for (uint32_t i = 0; i < n; i++) {
>   ^
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c: In function ‘opdl_xstats_get_by_name’:
> /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> ts.c:145:2: error: ‘for’ loop initial declarations are only allowed in
> C99 mode
>   for (uint32_t i = 0; i < max_index; i++) {


Tested with gcc(7.2 and 5.3) and clang(5.0.1) versions. Found no issues.
Which compiler you are using?


> ..
> ..
>   ^
> 
> Thanks,
> Harish
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Compilation errors in drivers/event/opdl/
  2018-01-20  8:44 ` Thomas Monjalon
@ 2018-01-21 17:34   ` Stephen Hemminger
  2018-01-21 17:49     ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2018-01-21 17:34 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Patil, Harish, liang.j.ma, peter.mccarthy, jerin.jacob, dev,
	ferruh.yigit

On Sat, 20 Jan 2018 09:44:46 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> 20/01/2018 06:18, Patil, Harish:
> > Hi,
> > 
> > I am seeing below compilation errors in drivers/event/opdl/, this is with
> > cloned latest DPDK (git clone http://dpdk.org/git/dpdk).
> > 
> > ..
> > ..
> > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> > ts.c: In function ‘opdl_xstats_get_names’:
> > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> > ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in
> > C99 mode
> >   for (uint32_t j = 0; j < max_num_port_xstat; j++) {
> >   ^  
> 
> My compiler does not raise this error.
> What is your compiler?
> 
> Anyone to fix it QUICKLY please? today?
> 
> Harish, do you think we should revert if not fixed?

Using declaration in for loop is a C++ thing which was inherited into C99.
Does DPDK require C99 mode?

Putting loop variables in for() looks better, but the rest of DPDK
doesn't use that style.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Compilation errors in drivers/event/opdl/
  2018-01-21 17:34   ` Stephen Hemminger
@ 2018-01-21 17:49     ` Thomas Monjalon
  2018-01-26 17:39       ` Adrien Mazarguil
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2018-01-21 17:49 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Patil, Harish, liang.j.ma, peter.mccarthy, jerin.jacob, dev,
	ferruh.yigit, adrien.mazarguil

21/01/2018 18:34, Stephen Hemminger:
> On Sat, 20 Jan 2018 09:44:46 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > 20/01/2018 06:18, Patil, Harish:
> > > Hi,
> > > 
> > > I am seeing below compilation errors in drivers/event/opdl/, this is with
> > > cloned latest DPDK (git clone http://dpdk.org/git/dpdk).
> > > 
> > > ..
> > > ..
> > > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> > > ts.c: In function ‘opdl_xstats_get_names’:
> > > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> > > ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in
> > > C99 mode
> > >   for (uint32_t j = 0; j < max_num_port_xstat; j++) {
> > >   ^  
> > 
> > My compiler does not raise this error.
> > What is your compiler?
> > 
> > Anyone to fix it QUICKLY please? today?
> > 
> > Harish, do you think we should revert if not fixed?
> 
> Using declaration in for loop is a C++ thing which was inherited into C99.
> Does DPDK require C99 mode?

No DPDK is not generally C99.

> Putting loop variables in for() looks better, but the rest of DPDK
> doesn't use that style.

C99 was forced for this driver as a quick fix.

Either the coding style guideline is updated to C99,
or this driver must be adapted to the DPDK coding style.
I have no strong opinion.

Is C99 well supported in all compilers we want to use (including Windows)?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Compilation errors in drivers/event/opdl/
  2018-01-20  8:56 ` Jerin Jacob
@ 2018-01-22 18:38   ` Patil, Harish
  0 siblings, 0 replies; 7+ messages in thread
From: Patil, Harish @ 2018-01-22 18:38 UTC (permalink / raw)
  To: Jacob,  Jerin; +Cc: liang.j.ma, peter.mccarthy, dev



-----Original Message-----
From: "Jacob,  Jerin" <Jerin.JacobKollanukkaran@cavium.com>
Date: Saturday, January 20, 2018 at 12:56 AM
To: Harish Patil <Harish.Patil@cavium.com>
Cc: "liang.j.ma@intel.com" <liang.j.ma@intel.com>,
"peter.mccarthy@intel.com" <peter.mccarthy@intel.com>, "dev@dpdk.org"
<dev@dpdk.org>
Subject: Re: [dpdk-dev] Compilation errors in drivers/event/opdl/

>-----Original Message-----
>> Date: Sat, 20 Jan 2018 05:18:30 +0000
>> From: "Patil, Harish" <Harish.Patil@cavium.com>
>> To: "liang.j.ma@intel.com" <liang.j.ma@intel.com>,
>>  "peter.mccarthy@intel.com" <peter.mccarthy@intel.com>
>> CC: "dev@dpdk.org" <dev@dpdk.org>
>> Subject: [dpdk-dev] Compilation errors in drivers/event/opdl/
>> 
>> [This sender failed our fraud detection checks and may not be who they
>>appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
>> 
>> Hi,
>> 
>> I am seeing below compilation errors in drivers/event/opdl/, this is
>>with
>> cloned latest DPDK (git clone http://dpdk.org/git/dpdk).
>> 
>> ..
>> ..
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c: In function ‘opdl_xstats_get_names’:
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c:89:2: error: ‘for’ loop initial declarations are only allowed
>>in
>> C99 mode
>>   for (uint32_t j = 0; j < max_num_port_xstat; j++) {
>>   ^
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c:89:2: note: use option -std=c99 or -std=gnu99 to compile your code
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c: In function ‘opdl_xstats_get’:
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c:124:2: error: ‘for’ loop initial declarations are only allowed
>>in
>> C99 mode
>>   for (uint32_t i = 0; i < n; i++) {
>>   ^
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c: In function ‘opdl_xstats_get_by_name’:
>> 
>>/home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xs
>>ta
>> ts.c:145:2: error: ‘for’ loop initial declarations are only allowed
>>in
>> C99 mode
>>   for (uint32_t i = 0; i < max_index; i++) {
>
>
>Tested with gcc(7.2 and 5.3) and clang(5.0.1) versions. Found no issues.
>Which compiler you are using?
>
>
>> ..
>> ..
>>   ^
>> 
>> Thanks,
>> Harish
>> 
>> 
>> 
>> 
>> 

This is older GCC 4.8.5 that comes inbox with RH7.2
So if its working with later GCC versions then please can ignore this.
Thanks.
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] Compilation errors in drivers/event/opdl/
  2018-01-21 17:49     ` Thomas Monjalon
@ 2018-01-26 17:39       ` Adrien Mazarguil
  0 siblings, 0 replies; 7+ messages in thread
From: Adrien Mazarguil @ 2018-01-26 17:39 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Stephen Hemminger, Patil, Harish, liang.j.ma, peter.mccarthy,
	jerin.jacob, dev, ferruh.yigit

(Replying since you added me to this thread)

On Sun, Jan 21, 2018 at 06:49:13PM +0100, Thomas Monjalon wrote:
> 21/01/2018 18:34, Stephen Hemminger:
> > On Sat, 20 Jan 2018 09:44:46 +0100
> > Thomas Monjalon <thomas@monjalon.net> wrote:
> > 
> > > 20/01/2018 06:18, Patil, Harish:
> > > > Hi,
> > > > 
> > > > I am seeing below compilation errors in drivers/event/opdl/, this is with
> > > > cloned latest DPDK (git clone http://dpdk.org/git/dpdk).
> > > > 
> > > > ..
> > > > ..
> > > > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> > > > ts.c: In function ‘opdl_xstats_get_names’:
> > > > /home2/hpatil/e4/jan19-inbox-submit/dpdk/drivers/event/opdl/opdl_evdev_xsta
> > > > ts.c:89:2: error: ‘for’ loop initial declarations are only allowed in
> > > > C99 mode
> > > >   for (uint32_t j = 0; j < max_num_port_xstat; j++) {
> > > >   ^  
> > > 
> > > My compiler does not raise this error.
> > > What is your compiler?
> > > 
> > > Anyone to fix it QUICKLY please? today?
> > > 
> > > Harish, do you think we should revert if not fixed?
> > 
> > Using declaration in for loop is a C++ thing which was inherited into C99.
> > Does DPDK require C99 mode?
> 
> No DPDK is not generally C99.

Except we use enough C99isms (named initializers anyone?) that I think it's
safe to say DPDK won't ever compile in C90 mode.

> 
> > Putting loop variables in for() looks better, but the rest of DPDK
> > doesn't use that style.
> 
> C99 was forced for this driver as a quick fix.
> 
> Either the coding style guideline is updated to C99,
> or this driver must be adapted to the DPDK coding style.
> I have no strong opinion.

When -std is not specified, depending on its version GCC defaults either to
gnu90, gnu99 or gnu11, all based on the C standard in question with a number
of GNU extensions.

Named initializers typically never fail because they're otherwise part of
the GNU extensions. Others such as the "for" declaration above apparently
aren't considered part of gnu90.

> Is C99 well supported in all compilers we want to use (including Windows)?

If by Windows you mean MSVC, from memory (likely outdated) it's actually a
C++ compiler that only provides limited support for C99, this fact will
trigger many other issues. The above loop won't be one of them though.

On the GCC/clang side, -std=gnu99 is what we assume in DPDK today without
explicitly documenting it. Exported headers conform a stricter standard,
they are compatible with -std=c99 with GNU extensions explicitly tagged
whenever they can't be worked around.

-- 
Adrien Mazarguil
6WIND

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-26 17:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-20  5:18 [dpdk-dev] Compilation errors in drivers/event/opdl/ Patil, Harish
2018-01-20  8:44 ` Thomas Monjalon
2018-01-21 17:34   ` Stephen Hemminger
2018-01-21 17:49     ` Thomas Monjalon
2018-01-26 17:39       ` Adrien Mazarguil
2018-01-20  8:56 ` Jerin Jacob
2018-01-22 18:38   ` Patil, Harish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).