public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* commas
@ 2013-08-07  9:17 Julia Lawall
  2013-08-07  9:29 ` commas Richard Genoud
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Julia Lawall @ 2013-08-07  9:17 UTC (permalink / raw)
  To: kernel-janitors

There are a number of places where kernel code uses commas, where one
might normally expect a semicolon.  For example,

drivers/cpufreq/sparc-us2e-cpufreq.c:

 		driver->target = us2e_freq_target;
 		driver->get = us2e_freq_get;
 		driver->exit = us2e_freq_cpu_exit;
		driver->owner = THIS_MODULE,     <------------- comma here
		strcpy(driver->name, "UltraSPARC-IIe");

 		cpufreq_us2e_driver = driver;
 		ret = cpufreq_register_driver(driver);

Is there any reason for this?  I guess that they are not very harmful, but
if one happens to write a static checker rule that expects a ;, then this
code will be overlooked.

julia

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

* Re: commas
  2013-08-07  9:17 commas Julia Lawall
@ 2013-08-07  9:29 ` Richard Genoud
  2013-08-07  9:31 ` commas Julia Lawall
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Genoud @ 2013-08-07  9:29 UTC (permalink / raw)
  To: kernel-janitors

2013/8/7 Julia Lawall <julia.lawall@lip6.fr>:
> There are a number of places where kernel code uses commas, where one
> might normally expect a semicolon.  For example,
>
> drivers/cpufreq/sparc-us2e-cpufreq.c:
>
>                 driver->target = us2e_freq_target;
>                 driver->get = us2e_freq_get;
>                 driver->exit = us2e_freq_cpu_exit;
>                 driver->owner = THIS_MODULE,     <------------- comma here
>                 strcpy(driver->name, "UltraSPARC-IIe");
>
>                 cpufreq_us2e_driver = driver;
>                 ret = cpufreq_register_driver(driver);
>
> Is there any reason for this?  I guess that they are not very harmful, but
> if one happens to write a static checker rule that expects a ;, then this
> code will be overlooked.
Hi Julia,

IMHO, the only reason there's a comma there is because the comma key
is next to the semi-colon on some keyboards :) (the french one for
instance).

Clearly, that was not intended here. I think it should be corrected.

Richard.

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

* Re: commas
  2013-08-07  9:17 commas Julia Lawall
  2013-08-07  9:29 ` commas Richard Genoud
@ 2013-08-07  9:31 ` Julia Lawall
  2013-08-07  9:47 ` commas Richard Genoud
  2013-08-07  9:49 ` commas Julia Lawall
  3 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2013-08-07  9:31 UTC (permalink / raw)
  To: kernel-janitors



On Wed, 7 Aug 2013, Richard Genoud wrote:

> 2013/8/7 Julia Lawall <julia.lawall@lip6.fr>:
> > There are a number of places where kernel code uses commas, where one
> > might normally expect a semicolon.  For example,
> >
> > drivers/cpufreq/sparc-us2e-cpufreq.c:
> >
> >                 driver->target = us2e_freq_target;
> >                 driver->get = us2e_freq_get;
> >                 driver->exit = us2e_freq_cpu_exit;
> >                 driver->owner = THIS_MODULE,     <------------- comma here
> >                 strcpy(driver->name, "UltraSPARC-IIe");
> >
> >                 cpufreq_us2e_driver = driver;
> >                 ret = cpufreq_register_driver(driver);
> >
> > Is there any reason for this?  I guess that they are not very harmful, but
> > if one happens to write a static checker rule that expects a ;, then this
> > code will be overlooked.
> Hi Julia,
>
> IMHO, the only reason there's a comma there is because the comma key
> is next to the semi-colon on some keyboards :) (the french one for
> instance).
>
> Clearly, that was not intended here. I think it should be corrected.

OK, thanks.  To be clear, this is not an isolated example.  There are over
500 of them, in 129 files.  But I can't imagine why any of them should be
there.

julia

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

* Re: commas
  2013-08-07  9:17 commas Julia Lawall
  2013-08-07  9:29 ` commas Richard Genoud
  2013-08-07  9:31 ` commas Julia Lawall
@ 2013-08-07  9:47 ` Richard Genoud
  2013-08-07  9:49 ` commas Julia Lawall
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Genoud @ 2013-08-07  9:47 UTC (permalink / raw)
  To: kernel-janitors

2013/8/7 Julia Lawall <julia.lawall@lip6.fr>:
>
>
> On Wed, 7 Aug 2013, Richard Genoud wrote:
>
>> 2013/8/7 Julia Lawall <julia.lawall@lip6.fr>:
>> > There are a number of places where kernel code uses commas, where one
>> > might normally expect a semicolon.  For example,
>> >
>> > drivers/cpufreq/sparc-us2e-cpufreq.c:
>> >
>> >                 driver->target = us2e_freq_target;
>> >                 driver->get = us2e_freq_get;
>> >                 driver->exit = us2e_freq_cpu_exit;
>> >                 driver->owner = THIS_MODULE,     <------------- comma here
>> >                 strcpy(driver->name, "UltraSPARC-IIe");
>> >
>> >                 cpufreq_us2e_driver = driver;
>> >                 ret = cpufreq_register_driver(driver);
>> >
>> > Is there any reason for this?  I guess that they are not very harmful, but
>> > if one happens to write a static checker rule that expects a ;, then this
>> > code will be overlooked.
>> Hi Julia,
>>
>> IMHO, the only reason there's a comma there is because the comma key
>> is next to the semi-colon on some keyboards :) (the french one for
>> instance).
>>
>> Clearly, that was not intended here. I think it should be corrected.
>
> OK, thanks.  To be clear, this is not an isolated example.  There are over
> 500 of them, in 129 files.  But I can't imagine why any of them should be
> there.
ouch !
That's quite a lot !
I was thinking about what nasty things could happen with that operator
when it is used instead of the semi-colon.
I could only think of something like that:
if (foo)
 a=1,
 b=2;
(same with loops)

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

* Re: commas
  2013-08-07  9:17 commas Julia Lawall
                   ` (2 preceding siblings ...)
  2013-08-07  9:47 ` commas Richard Genoud
@ 2013-08-07  9:49 ` Julia Lawall
  3 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2013-08-07  9:49 UTC (permalink / raw)
  To: kernel-janitors

On Wed, 7 Aug 2013, Richard Genoud wrote:

> 2013/8/7 Julia Lawall <julia.lawall@lip6.fr>:
> >
> >
> > On Wed, 7 Aug 2013, Richard Genoud wrote:
> >
> >> 2013/8/7 Julia Lawall <julia.lawall@lip6.fr>:
> >> > There are a number of places where kernel code uses commas, where one
> >> > might normally expect a semicolon.  For example,
> >> >
> >> > drivers/cpufreq/sparc-us2e-cpufreq.c:
> >> >
> >> >                 driver->target = us2e_freq_target;
> >> >                 driver->get = us2e_freq_get;
> >> >                 driver->exit = us2e_freq_cpu_exit;
> >> >                 driver->owner = THIS_MODULE,     <------------- comma here
> >> >                 strcpy(driver->name, "UltraSPARC-IIe");
> >> >
> >> >                 cpufreq_us2e_driver = driver;
> >> >                 ret = cpufreq_register_driver(driver);
> >> >
> >> > Is there any reason for this?  I guess that they are not very harmful, but
> >> > if one happens to write a static checker rule that expects a ;, then this
> >> > code will be overlooked.
> >> Hi Julia,
> >>
> >> IMHO, the only reason there's a comma there is because the comma key
> >> is next to the semi-colon on some keyboards :) (the french one for
> >> instance).
> >>
> >> Clearly, that was not intended here. I think it should be corrected.
> >
> > OK, thanks.  To be clear, this is not an isolated example.  There are over
> > 500 of them, in 129 files.  But I can't imagine why any of them should be
> > there.
> ouch !
> That's quite a lot !
> I was thinking about what nasty things could happen with that operator
> when it is used instead of the semi-colon.
> I could only think of something like that:
> if (foo)
>  a=1,
>  b=2;
> (same with loops)

Thanks for the tip.  I will definitely look out for that.

julia

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

end of thread, other threads:[~2013-08-07  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07  9:17 commas Julia Lawall
2013-08-07  9:29 ` commas Richard Genoud
2013-08-07  9:31 ` commas Julia Lawall
2013-08-07  9:47 ` commas Richard Genoud
2013-08-07  9:49 ` commas Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox