2002-07-22 10:58:43

by Marcin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.27 sysctl

Christoph Hellwig wrote:
> On Mon, Jul 22, 2002 at 12:42:07PM +0200, Marcin Dalecki wrote:
>
>>This is making the sysctl code acutally be written in C.
>>It wasn't mostly due to georgeous ommitted size array "forward
>>declarations". As a side effect it makes the table structure easier to
>>deduce.
>
>
> Please don't remove the trailing commas in the enums. they make adding
> to them much easier and are allowed by gcc (and maybe C99, I'm not
> sure).

It's an GNU-ism. If you have any problem with "adding vales", just
invent some dummy end-value. I have a problem with using -pedantic.


2002-07-22 11:18:47

by Bart Hartgers

[permalink] [raw]
Subject: Re: [PATCH] 2.5.27 sysctl

On 22 Jul, Marcin Dalecki wrote:
> Christoph Hellwig wrote:
>> On Mon, Jul 22, 2002 at 12:42:07PM +0200, Marcin Dalecki wrote:
>>
>>>This is making the sysctl code acutally be written in C.
>>>It wasn't mostly due to georgeous ommitted size array "forward
>>>declarations". As a side effect it makes the table structure easier to
>>>deduce.
>>
>>
>> Please don't remove the trailing commas in the enums. they make adding
>> to them much easier and are allowed by gcc (and maybe C99, I'm not
>> sure).
>
> It's an GNU-ism. If you have any problem with "adding vales", just
> invent some dummy end-value. I have a problem with using -pedantic.
>

Trailing commas in enums were NOT allowed before C99. C99 allows them,
and gcc and some other compilers allowed this syntax before C99.
Since the kernel is going to use the .field= (C99) syntax for structure
initialisers anyway, I don't see any point in removing trailing commas.
(Especially not in code I once wrote :-))

As an aside, the fact that gcc warns about them is probably a compiler
bug: (http://gcc.gnu.org/c99status.html)
'In some places, -pedantic warnings don't take proper account of the
standard version selected.'

Bart

> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Bart Hartgers - TUE Eindhoven
http://plasimo.phys.tue.nl/bart/contact.html

2002-07-22 11:16:14

by BALBIR SINGH

[permalink] [raw]
Subject: RE: [PATCH] 2.5.27 sysctl

|-----Original Message-----
|From: [email protected]
|[mailto:[email protected]] On Behalf Of Marcin Dalecki
|Sent: Monday, July 22, 2002 4:26 PM
|To: Christoph Hellwig
|Cc: [email protected]; Linus Torvalds; Kernel Mailing List
|Subject: Re: [PATCH] 2.5.27 sysctl
|
|
|Christoph Hellwig wrote:
|> On Mon, Jul 22, 2002 at 12:42:07PM +0200, Marcin Dalecki wrote:
|>
|>>This is making the sysctl code acutally be written in C.
|>>It wasn't mostly due to georgeous ommitted size array "forward
|>>declarations". As a side effect it makes the table structure
|easier to
|>>deduce.
|>
|>
|> Please don't remove the trailing commas in the enums. they make
|> adding to them much easier and are allowed by gcc (and maybe
|C99, I'm
|> not sure).
|
|It's an GNU-ism. If you have any problem with "adding vales",
|just invent some dummy end-value. I have a problem with using
|-pedantic.

Its not, ANSI C allows a trailing comma.

Balbir


Attachments:
Wipro_Disclaimer.txt (490.00 B)

2002-07-22 11:01:59

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] 2.5.27 sysctl

On Mon, Jul 22, 2002 at 12:56:07PM +0200, Marcin Dalecki wrote:
> > Please don't remove the trailing commas in the enums. they make adding
> > to them much easier and are allowed by gcc (and maybe C99, I'm not
> > sure).
>
> It's an GNU-ism.

So what?

The kernel is full of GNUisms, and this one is actually usefull.

> If you have any problem with "adding vales", just
> invent some dummy end-value. I have a problem with using -pedantic.

-pedantic barfs on named initializers, so you have to remove them first.

2002-07-22 11:10:51

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] 2.5.27 sysctl

On Mon, Jul 22, 2002 at 12:56:07PM +0200, Marcin Dalecki wrote:
> It's an GNU-ism.

Actually I've looked it up in my copy of the last C99 draft:

[#5] This edition replaces the previous edition, ISO/IEC |
9899:1990, as amended and corrected by ISO/IEC |
9899/COR1:1994, ISO/IEC 9899/COR2:1995, and ISO/IEC |
9899/AMD1:1995. Major changes from the previous edition |
include:

[some stuff snipped]

-- trailing comma allowed in enum declaration |

So please let it in.

2002-07-22 11:14:54

by Alan

[permalink] [raw]
Subject: Re: [PATCH] 2.5.27 sysctl

On Mon, 2002-07-22 at 11:56, Marcin Dalecki wrote:
> Christoph Hellwig wrote:
> > On Mon, Jul 22, 2002 at 12:42:07PM +0200, Marcin Dalecki wrote:
> >
> >>This is making the sysctl code acutally be written in C.
> >>It wasn't mostly due to georgeous ommitted size array "forward
> >>declarations". As a side effect it makes the table structure easier to
> >>deduce.
> >
> >
> > Please don't remove the trailing commas in the enums. they make adding
> > to them much easier and are allowed by gcc (and maybe C99, I'm not
> > sure).
>
> It's an GNU-ism. If you have any problem with "adding vales", just
> invent some dummy end-value. I have a problem with using -pedantic.

You seem to have it permanently engaged 8)

If you are upset about that GNUism why doesn't your patch fix the other
GNU-isms in the same file ? Also the entire kernel is *full* of GNU C
extensions.


2002-07-22 11:17:41

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] 2.5.27 sysctl

On Mon, Jul 22, 2002 at 12:56:07PM +0200, Marcin Dalecki wrote:

> > Please don't remove the trailing commas in the enums. they make adding
> > to them much easier and are allowed by gcc (and maybe C99, I'm not
> > sure).
> It's an GNU-ism. If you have any problem with "adding vales", just
> invent some dummy end-value. I have a problem with using -pedantic.

If you feel like doing 'warnings patrol', then there are a bunch of
more important regular warnings[1] that need fixing up without having to look
through the pedantic output. Last I checked the pedantic stuff flagged
a lot of bits that the fix ended up uglier than the warning
(which 99.9% of people won't ever see anyway)

Dave

[1] Although more important would be stabilising IDE, but thats a sidenote.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs