Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-09 Thread Al Viro
On Tue, Jun 05, 2007 at 09:37:36AM +0800, WANG Cong wrote: > I agree. Local labels maybe useful in macros. > If someone will use local labels in his code some day, we shouldn't force him > to align his labels in the first column. No, we should just force him to rewrite his dreck into a readable

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-09 Thread Al Viro
On Tue, Jun 05, 2007 at 09:37:36AM +0800, WANG Cong wrote: I agree. Local labels maybe useful in macros. If someone will use local labels in his code some day, we shouldn't force him to align his labels in the first column. No, we should just force him to rewrite his dreck into a readable

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-05 Thread WANG Cong
On Tue, Jun 05, 2007 at 11:16:13AM +0200, Rene Herman wrote: >On 06/05/2007 04:10 AM, WANG Cong wrote: > >>On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: > >>>A matter of opinion :) I tend to think goto is special enough to >>>warrant column 1 unconditionally. It is special, so it

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-05 Thread Rene Herman
On 06/05/2007 04:10 AM, WANG Cong wrote: On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: A matter of opinion :) I tend to think goto is special enough to warrant column 1 unconditionally. It is special, so it draws additional attention over and above case labels. I and others

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-05 Thread WANG Cong
On Mon, Jun 04, 2007 at 07:31:27PM -0700, H. Peter Anvin wrote: >Jeff Garzik wrote: >>> >>> So, it seems that we can reach an agreement. Any other comments or >>> suggestions? >>> Or can someone ack/merge this patch? >> >> Honestly, I think not reaching an agreement is a good thing. >> >>

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-05 Thread WANG Cong
On Mon, Jun 04, 2007 at 07:31:27PM -0700, H. Peter Anvin wrote: Jeff Garzik wrote: So, it seems that we can reach an agreement. Any other comments or suggestions? Or can someone ack/merge this patch? Honestly, I think not reaching an agreement is a good thing. style is always ultimately

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-05 Thread Rene Herman
On 06/05/2007 04:10 AM, WANG Cong wrote: On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: A matter of opinion :) I tend to think goto is special enough to warrant column 1 unconditionally. It is special, so it draws additional attention over and above case labels. I and others

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-05 Thread WANG Cong
On Tue, Jun 05, 2007 at 11:16:13AM +0200, Rene Herman wrote: On 06/05/2007 04:10 AM, WANG Cong wrote: On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: A matter of opinion :) I tend to think goto is special enough to warrant column 1 unconditionally. It is special, so it draws

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeff Garzik wrote: >> >> So, it seems that we can reach an agreement. Any other comments or >> suggestions? >> Or can someone ack/merge this patch? > > Honestly, I think not reaching an agreement is a good thing. > > "style" is always ultimately in the eye of the beholder, and reasoned > people

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeff Garzik
On Tue, Jun 05, 2007 at 10:10:27AM +0800, WANG Cong wrote: > On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: > >On Mon, Jun 04, 2007 at 10:43:51AM -0700, H. Peter Anvin wrote: > >> Jan Engelhardt wrote: > >> > On Jun 4 2007 10:27, H. Peter Anvin wrote: > >> >> Jeff Garzik wrote: > >>

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread WANG Cong
On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: >On Mon, Jun 04, 2007 at 10:43:51AM -0700, H. Peter Anvin wrote: >> Jan Engelhardt wrote: >> > On Jun 4 2007 10:27, H. Peter Anvin wrote: >> >> Jeff Garzik wrote: >> >>> Seconded. All my code contains the goto label in the first column.

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread WANG Cong
On Mon, Jun 04, 2007 at 12:02:28PM -0700, Jeremy Fitzhardinge wrote: >Sam Ravnborg wrote: >> If local(__label__) really so widely used in the kernel that it deserves >> a place in coding-style? >> A quick grep did not say so. >> > >Probably not, and its use shouldn't be (even tacitly)

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeff Garzik
On Mon, Jun 04, 2007 at 10:43:51AM -0700, H. Peter Anvin wrote: > Jan Engelhardt wrote: > > On Jun 4 2007 10:27, H. Peter Anvin wrote: > >> Jeff Garzik wrote: > >>> Seconded. All my code contains the goto label in the first column. > >>> > >>> IMO any other goto label indentation is silly,

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeremy Fitzhardinge wrote: > H. Peter Anvin wrote: >> goto labels are scoped in one sense: they are only reachable from inside >> the block they are defined in, so I would disagree with this statement. >> > > Erm, no I think you're wrong there Yeah, I realized I was talking out of my ass

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread Jeremy Fitzhardinge
Sam Ravnborg wrote: > If local(__label__) really so widely used in the kernel that it deserves > a place in coding-style? > A quick grep did not say so. > Probably not, and its use shouldn't be (even tacitly) encouraged. It's only really useful for defining a local label within a macro, and

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeremy Fitzhardinge
H. Peter Anvin wrote: > goto labels are scoped in one sense: they are only reachable from inside > the block they are defined in, so I would disagree with this statement. > Erm, no I think you're wrong there (or we're talking at cross purposes). They're visible to the whole function they're

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread Sam Ravnborg
On Mon, Jun 04, 2007 at 04:19:38PM +0800, WANG Cong wrote: > > Lindent gets wrong when it meets goto labels. This should be fixed manually. > And kernel's CodingStyle doesn't specify the indentation for goto labels > explicitly. > > This patch adds specifications on those things about goto

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
[EMAIL PROTECTED] wrote: >> >> You still want them to be associated with the level the bailout happens at. > > No, you want them associated with the level you bail out *TO*. Otherwise you > get this: > Right, I misspoke. -hpa - To unsubscribe from this list: send the line "unsubscribe

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Valdis . Kletnieks
On Mon, 04 Jun 2007 10:43:51 PDT, "H. Peter Anvin" said: > Jan Engelhardt wrote: > > But gotos are special. ("Evil" minus the "it's good for unrolling in case > > of an > > error" case). > So? > > You still want them to be associated with the level the bailout happens at. No, you want them

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jan Engelhardt wrote: > On Jun 4 2007 10:27, H. Peter Anvin wrote: >> Jeff Garzik wrote: >>> Seconded. All my code contains the goto label in the first column. >>> >>> IMO any other goto label indentation is silly, because it obscures the >>> goto label within the code block. >> I would have to

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jan Engelhardt
On Jun 4 2007 10:27, H. Peter Anvin wrote: >Jeff Garzik wrote: >> >> Seconded. All my code contains the goto label in the first column. >> >> IMO any other goto label indentation is silly, because it obscures the >> goto label within the code block. > >I would have to disagree with this.

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeremy Fitzhardinge wrote: > WANG Cong wrote: >> I just wonder, if a goto label is nested in a while/for/if/switch block, >> aligning it in >> the first column maybe a bit ugly. (I know mostly it is not in any >> while/for/if/switch block.) > > In general goto labels are not scoped, so there's

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeff Garzik wrote: > > Seconded. All my code contains the goto label in the first column. > > IMO any other goto label indentation is silly, because it obscures the > goto label within the code block. > I would have to disagree with this. IMNSHO, a goto label is like a case label, and they

[RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread WANG Cong
Lindent gets wrong when it meets goto labels. This should be fixed manually. And kernel's CodingStyle doesn't specify the indentation for goto labels explicitly. This patch adds specifications on those things about goto labels in CodingStyle. And it is against -rc3 source tree. Thanks to Al

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread WANG Cong
On Sun, Jun 03, 2007 at 11:59:26PM -0700, Jeremy Fitzhardinge wrote: >WANG Cong wrote: >> I just wonder, if a goto label is nested in a while/for/if/switch block, >> aligning it in >> the first column maybe a bit ugly. (I know mostly it is not in any >> while/for/if/switch block.) >> > >In

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeremy Fitzhardinge
WANG Cong wrote: > I just wonder, if a goto label is nested in a while/for/if/switch block, > aligning it in > the first column maybe a bit ugly. (I know mostly it is not in any > while/for/if/switch block.) > In general goto labels are not scoped, so there's no point in pretending they are.

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeremy Fitzhardinge
WANG Cong wrote: I just wonder, if a goto label is nested in a while/for/if/switch block, aligning it in the first column maybe a bit ugly. (I know mostly it is not in any while/for/if/switch block.) In general goto labels are not scoped, so there's no point in pretending they are. It

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread WANG Cong
On Sun, Jun 03, 2007 at 11:59:26PM -0700, Jeremy Fitzhardinge wrote: WANG Cong wrote: I just wonder, if a goto label is nested in a while/for/if/switch block, aligning it in the first column maybe a bit ugly. (I know mostly it is not in any while/for/if/switch block.) In general goto

[RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread WANG Cong
Lindent gets wrong when it meets goto labels. This should be fixed manually. And kernel's CodingStyle doesn't specify the indentation for goto labels explicitly. This patch adds specifications on those things about goto labels in CodingStyle. And it is against -rc3 source tree. Thanks to Al

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeff Garzik wrote: Seconded. All my code contains the goto label in the first column. IMO any other goto label indentation is silly, because it obscures the goto label within the code block. I would have to disagree with this. IMNSHO, a goto label is like a case label, and they should

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeremy Fitzhardinge wrote: WANG Cong wrote: I just wonder, if a goto label is nested in a while/for/if/switch block, aligning it in the first column maybe a bit ugly. (I know mostly it is not in any while/for/if/switch block.) In general goto labels are not scoped, so there's no point in

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jan Engelhardt
On Jun 4 2007 10:27, H. Peter Anvin wrote: Jeff Garzik wrote: Seconded. All my code contains the goto label in the first column. IMO any other goto label indentation is silly, because it obscures the goto label within the code block. I would have to disagree with this. IMNSHO, a goto

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jan Engelhardt wrote: On Jun 4 2007 10:27, H. Peter Anvin wrote: Jeff Garzik wrote: Seconded. All my code contains the goto label in the first column. IMO any other goto label indentation is silly, because it obscures the goto label within the code block. I would have to disagree with

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Valdis . Kletnieks
On Mon, 04 Jun 2007 10:43:51 PDT, H. Peter Anvin said: Jan Engelhardt wrote: But gotos are special. (Evil minus the it's good for unrolling in case of an error case). So? You still want them to be associated with the level the bailout happens at. No, you want them associated with the

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
[EMAIL PROTECTED] wrote: You still want them to be associated with the level the bailout happens at. No, you want them associated with the level you bail out *TO*. Otherwise you get this: Right, I misspoke. -hpa - To unsubscribe from this list: send the line unsubscribe

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread Sam Ravnborg
On Mon, Jun 04, 2007 at 04:19:38PM +0800, WANG Cong wrote: Lindent gets wrong when it meets goto labels. This should be fixed manually. And kernel's CodingStyle doesn't specify the indentation for goto labels explicitly. This patch adds specifications on those things about goto labels in

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeremy Fitzhardinge
H. Peter Anvin wrote: goto labels are scoped in one sense: they are only reachable from inside the block they are defined in, so I would disagree with this statement. Erm, no I think you're wrong there (or we're talking at cross purposes). They're visible to the whole function they're

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread Jeremy Fitzhardinge
Sam Ravnborg wrote: If local(__label__) really so widely used in the kernel that it deserves a place in coding-style? A quick grep did not say so. Probably not, and its use shouldn't be (even tacitly) encouraged. It's only really useful for defining a local label within a macro, and

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeremy Fitzhardinge wrote: H. Peter Anvin wrote: goto labels are scoped in one sense: they are only reachable from inside the block they are defined in, so I would disagree with this statement. Erm, no I think you're wrong there Yeah, I realized I was talking out of my ass there when

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeff Garzik
On Mon, Jun 04, 2007 at 10:43:51AM -0700, H. Peter Anvin wrote: Jan Engelhardt wrote: On Jun 4 2007 10:27, H. Peter Anvin wrote: Jeff Garzik wrote: Seconded. All my code contains the goto label in the first column. IMO any other goto label indentation is silly, because it obscures the

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels (-v2)

2007-06-04 Thread WANG Cong
On Mon, Jun 04, 2007 at 12:02:28PM -0700, Jeremy Fitzhardinge wrote: Sam Ravnborg wrote: If local(__label__) really so widely used in the kernel that it deserves a place in coding-style? A quick grep did not say so. Probably not, and its use shouldn't be (even tacitly) encouraged. It's

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread Jeff Garzik
On Tue, Jun 05, 2007 at 10:10:27AM +0800, WANG Cong wrote: On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: On Mon, Jun 04, 2007 at 10:43:51AM -0700, H. Peter Anvin wrote: Jan Engelhardt wrote: On Jun 4 2007 10:27, H. Peter Anvin wrote: Jeff Garzik wrote: Seconded. All my

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread WANG Cong
On Mon, Jun 04, 2007 at 01:57:51PM -0400, Jeff Garzik wrote: On Mon, Jun 04, 2007 at 10:43:51AM -0700, H. Peter Anvin wrote: Jan Engelhardt wrote: On Jun 4 2007 10:27, H. Peter Anvin wrote: Jeff Garzik wrote: Seconded. All my code contains the goto label in the first column. IMO any

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-04 Thread H. Peter Anvin
Jeff Garzik wrote: So, it seems that we can reach an agreement. Any other comments or suggestions? Or can someone ack/merge this patch? Honestly, I think not reaching an agreement is a good thing. style is always ultimately in the eye of the beholder, and reasoned people come up with

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread WANG Cong
On Sun, Jun 03, 2007 at 11:35:43AM -0400, Jeff Garzik wrote: >Randy Dunlap wrote: >>On Sun, 3 Jun 2007 15:29:39 +0100 Al Viro wrote: >> >>>On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: >>> +Do care when you use Lindent to indent your code, since it may use spaces

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread Jeff Garzik
Randy Dunlap wrote: On Sun, 3 Jun 2007 15:29:39 +0100 Al Viro wrote: On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: +Do care when you use Lindent to indent your code, since it may use spaces +instead of tabs before a goto label and it may also align the label in a +wrong

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread Randy Dunlap
On Sun, 3 Jun 2007 15:29:39 +0100 Al Viro wrote: > On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: > > > +Do care when you use Lindent to indent your code, since it may use spaces > > +instead of tabs before a goto label and it may also align the label in a > > +wrong position. A

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread Al Viro
On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: > +Do care when you use Lindent to indent your code, since it may use spaces > +instead of tabs before a goto label and it may also align the label in a > +wrong position. A goto label should be aligned in the column that is 8 >

[RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread WANG Cong
There are many people use Lindent to indent their code, but Lindent gets wrong when it meets goto labels. This should be fixed manually. And kernel's CodingStyle doesn't specify the indentation for goto labels explicitly. This patch adds specifications on those things about goto labels in

[RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread WANG Cong
There are many people use Lindent to indent their code, but Lindent gets wrong when it meets goto labels. This should be fixed manually. And kernel's CodingStyle doesn't specify the indentation for goto labels explicitly. This patch adds specifications on those things about goto labels in

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread Al Viro
On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: +Do care when you use Lindent to indent your code, since it may use spaces +instead of tabs before a goto label and it may also align the label in a +wrong position. A goto label should be aligned in the column that is 8 +characters

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread Randy Dunlap
On Sun, 3 Jun 2007 15:29:39 +0100 Al Viro wrote: On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: +Do care when you use Lindent to indent your code, since it may use spaces +instead of tabs before a goto label and it may also align the label in a +wrong position. A goto label

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread Jeff Garzik
Randy Dunlap wrote: On Sun, 3 Jun 2007 15:29:39 +0100 Al Viro wrote: On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: +Do care when you use Lindent to indent your code, since it may use spaces +instead of tabs before a goto label and it may also align the label in a +wrong

Re: [RFC] Documentation/CodingStyle: Add rules for goto labels

2007-06-03 Thread WANG Cong
On Sun, Jun 03, 2007 at 11:35:43AM -0400, Jeff Garzik wrote: Randy Dunlap wrote: On Sun, 3 Jun 2007 15:29:39 +0100 Al Viro wrote: On Sun, Jun 03, 2007 at 10:24:50PM +0800, WANG Cong wrote: +Do care when you use Lindent to indent your code, since it may use spaces +instead of tabs before a