public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* proposal: remove unused macros
@ 2006-11-13 18:13 Mariusz Kozlowski
  2006-11-14  2:19 ` Gene Heskett
  0 siblings, 1 reply; 6+ messages in thread
From: Mariusz Kozlowski @ 2006-11-13 18:13 UTC (permalink / raw)
  To: linux-kernel

Hello,

	Recently someone send a patch that fixed some old '#ifdef'ed code with syntax 
error (stray brackets). The broken code was there for a long time and nobody 
saw that. I digged some more and wrote a simple program that counted '(' 
and ')' in the kernel code that emits apropriate text if for a given file 
both numbers differ. That is probably dumb idea but it worked :-) Quite fast 
I found a dozen of broken macros with syntax errors etc. All of those macros 
are unused. I digged a bit deeper and used '-Wunused-macros' flag which with 
causes 8340 new warnings to be emited for 2.6.19-rc5-mm1 with 'allmodconfig'. 
For sure there are false positives (see gcc man page) but even if i.e. 50% of 
them are fp then we still have around 4k of unused macros scattered around 
the tree.

To me this is a dead code. I can review the code causing these warnings and 
prepare patches 'per subsystem' or whatever to address this issue. That is if 
nobody opposes.
-- 
Regards,

	Mariusz Kozlowski

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

* Re: proposal: remove unused macros
  2006-11-13 18:13 proposal: remove unused macros Mariusz Kozlowski
@ 2006-11-14  2:19 ` Gene Heskett
  2006-11-14  5:29   ` Randy Dunlap
  2006-11-14 11:18   ` Horst H. von Brand
  0 siblings, 2 replies; 6+ messages in thread
From: Gene Heskett @ 2006-11-14  2:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mariusz Kozlowski

On Monday 13 November 2006 13:13, Mariusz Kozlowski wrote:
>Hello,
>
>	Recently someone send a patch that fixed some old '#ifdef'ed code with
> syntax error (stray brackets). The broken code was there for a long
> time and nobody saw that. I digged some more and wrote a simple program
> that counted '(' and ')' in the kernel code that emits apropriate text
> if for a given file both numbers differ. That is probably dumb idea but
> it worked :-) Quite fast I found a dozen of broken macros with syntax
> errors etc. All of those macros are unused. I digged a bit deeper and
> used '-Wunused-macros' flag which with causes 8340 new warnings to be
> emited for 2.6.19-rc5-mm1 with 'allmodconfig'. For sure there are false
> positives (see gcc man page) but even if i.e. 50% of them are fp then
> we still have around 4k of unused macros scattered around the tree.
>
>To me this is a dead code. I can review the code causing these warnings
> and prepare patches 'per subsystem' or whatever to address this issue.
> That is if nobody opposes.

With regard to your parens checking code, I re-wrote from a broken 
version, about 20 years ago, a utility to check all that.  I used it on 
the coco/os9 systems at the time, then built it for the amiga, and 
rebuilt it for linux a few years back.  It checks brackets, quotes in " 
style and ' style and ;, etc stuff.  I called mine cntx, and I've used it 
occasionally here, but haven't had the need/urge to test any kernel code 
with it so far.

If anyone is interested, and the list will take attachments of that 
nature, I'd be honored to share it.  What say you all?

-- 
Cheers, Gene

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

* Re: proposal: remove unused macros
  2006-11-14  2:19 ` Gene Heskett
@ 2006-11-14  5:29   ` Randy Dunlap
  2006-11-14 11:18   ` Horst H. von Brand
  1 sibling, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2006-11-14  5:29 UTC (permalink / raw)
  To: Gene Heskett; +Cc: linux-kernel, Mariusz Kozlowski

On Mon, 13 Nov 2006 21:19:17 -0500 Gene Heskett wrote:

> On Monday 13 November 2006 13:13, Mariusz Kozlowski wrote:
> >Hello,
> >
> >	Recently someone send a patch that fixed some old '#ifdef'ed code with
> > syntax error (stray brackets). The broken code was there for a long
> > time and nobody saw that. I digged some more and wrote a simple program
> > that counted '(' and ')' in the kernel code that emits apropriate text
> > if for a given file both numbers differ. That is probably dumb idea but
> > it worked :-) Quite fast I found a dozen of broken macros with syntax
> > errors etc. All of those macros are unused. I digged a bit deeper and
> > used '-Wunused-macros' flag which with causes 8340 new warnings to be
> > emited for 2.6.19-rc5-mm1 with 'allmodconfig'. For sure there are false
> > positives (see gcc man page) but even if i.e. 50% of them are fp then
> > we still have around 4k of unused macros scattered around the tree.
> >
> >To me this is a dead code. I can review the code causing these warnings
> > and prepare patches 'per subsystem' or whatever to address this issue.
> > That is if nobody opposes.
> 
> With regard to your parens checking code, I re-wrote from a broken 
> version, about 20 years ago, a utility to check all that.  I used it on 
> the coco/os9 systems at the time, then built it for the amiga, and 
> rebuilt it for linux a few years back.  It checks brackets, quotes in " 
> style and ' style and ;, etc stuff.  I called mine cntx, and I've used it 
> occasionally here, but haven't had the need/urge to test any kernel code 
> with it so far.
> 
> If anyone is interested, and the list will take attachments of that 
> nature, I'd be honored to share it.  What say you all?

I'm interested.

Thanks,
---
~Randy

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

* Re: proposal: remove unused macros
  2006-11-14  2:19 ` Gene Heskett
  2006-11-14  5:29   ` Randy Dunlap
@ 2006-11-14 11:18   ` Horst H. von Brand
  2006-11-14 14:29     ` Gene Heskett
  1 sibling, 1 reply; 6+ messages in thread
From: Horst H. von Brand @ 2006-11-14 11:18 UTC (permalink / raw)
  To: Gene Heskett; +Cc: linux-kernel, Mariusz Kozlowski

Gene Heskett <gene.heskett@verizon.net> wrote:

[...]

> With regard to your parens checking code, I re-wrote from a broken 
> version, about 20 years ago, a utility to check all that.  I used it on 
> the coco/os9 systems at the time, then built it for the amiga, and 
> rebuilt it for linux a few years back.  It checks brackets, quotes in " 
> style and ' style and ;, etc stuff.  I called mine cntx, and I've used it 
> occasionally here, but haven't had the need/urge to test any kernel code 
> with it so far.
> 
> If anyone is interested, and the list will take attachments of that 
> nature, I'd be honored to share it.  What say you all?

I'd be interested. Licensing terms? GPLv2, BSD, ...?
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513

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

* Re: proposal: remove unused macros
  2006-11-14 11:18   ` Horst H. von Brand
@ 2006-11-14 14:29     ` Gene Heskett
  2006-11-14 14:37       ` Mariusz Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Gene Heskett @ 2006-11-14 14:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Horst H. von Brand, Mariusz Kozlowski

On Tuesday 14 November 2006 06:18, Horst H. von Brand wrote:
>Gene Heskett <gene.heskett@verizon.net> wrote:
>
>[...]
>
>> With regard to your parens checking code, I re-wrote from a broken
>> version, about 20 years ago, a utility to check all that.  I used it
>> on the coco/os9 systems at the time, then built it for the amiga, and
>> rebuilt it for linux a few years back.  It checks brackets, quotes in
>> " style and ' style and ;, etc stuff.  I called mine cntx, and I've
>> used it occasionally here, but haven't had the need/urge to test any
>> kernel code with it so far.
>>
>> If anyone is interested, and the list will take attachments of that
>> nature, I'd be honored to share it.  What say you all?
>
>I'd be interested. Licensing terms? GPLv2, BSD, ...?

Generally PD, I didn't change that.  I'll send a copy to your address.

-- 
Cheers, Gene

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

* Re: proposal: remove unused macros
  2006-11-14 14:29     ` Gene Heskett
@ 2006-11-14 14:37       ` Mariusz Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Mariusz Kozlowski @ 2006-11-14 14:37 UTC (permalink / raw)
  To: Gene Heskett; +Cc: linux-kernel, Horst H. von Brand

Hello, 

> >> If anyone is interested, and the list will take attachments of that
> >> nature, I'd be honored to share it.  What say you all?
> >
> >I'd be interested. Licensing terms? GPLv2, BSD, ...?
>
> Generally PD, I didn't change that.  I'll send a copy to your address.

Can you make it both with the code publicly available somewhere? My code was 
rather a 'proof of concept' and it is far from a real tool to share with 
people.

-- 
Regards,

	Mariusz Kozlowski

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

end of thread, other threads:[~2006-11-14 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-13 18:13 proposal: remove unused macros Mariusz Kozlowski
2006-11-14  2:19 ` Gene Heskett
2006-11-14  5:29   ` Randy Dunlap
2006-11-14 11:18   ` Horst H. von Brand
2006-11-14 14:29     ` Gene Heskett
2006-11-14 14:37       ` Mariusz Kozlowski

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