public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pedantic code cleanup - am I wasting my time with this?
@ 2001-04-23 15:26 Jesper Juhl
  2001-04-23 15:24 ` Jeff Garzik
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jesper Juhl @ 2001-04-23 15:26 UTC (permalink / raw)
  To: linux-kernel

Hi people,

I'm reading through various pieces of source code to try and get an 
understanding of how the kernel works (with the hope that I'll 
eventually be able to contribute something really usefull, but you've 
got to start somewhere ;)

While reading through the source I've stumbled across various bits and 
pieces that are not exactely wrong, but not strictly correct either. I 
was wondering if I would be wasting my time by cleaning this up or if it 
would actually be appreciated. One example of these things is the patch 
below:

--- linux-2.4.3-vanilla/include/linux/rtnetlink.h       Sun Apr 22 
02:29:20 2001
+++ linux-2.4.3/include/linux/rtnetlink.h       Mon Apr 23 17:09:02 2001
@@ -112,7 +112,7 @@
         RTN_PROHIBIT,           /* Administratively prohibited  */
         RTN_THROW,              /* Not in this table            */
         RTN_NAT,                /* Translate this address       */
-       RTN_XRESOLVE,           /* Use external resolver        */
+       RTN_XRESOLVE            /* Use external resolver        */
  };

  #define RTN_MAX RTN_XRESOLVE
@@ -278,7 +278,7 @@
  #define RTAX_CWND RTAX_CWND
         RTAX_ADVMSS,
  #define RTAX_ADVMSS RTAX_ADVMSS
-       RTAX_REORDERING,
+       RTAX_REORDERING
  #define RTAX_REORDERING RTAX_REORDERING
  };

@@ -501,7 +501,7 @@
         TCA_OPTIONS,
         TCA_STATS,
         TCA_XSTATS,
-       TCA_RATE,
+       TCA_RATE
  };

  #define TCA_MAX TCA_RATE


All the above does is to remove the last comma from 3 enumeration lists. 
I know that gcc has no problem with that, but to be strictly correct the 
last entry should not have a trailing comma.

Another example is the following line (1266) from linux/include/net/sock.h

         return (waitall ? len : min(sk->rcvlowat, len)) ? : 1;

To be strictly correct the second expression (between '?' and ':' ) 
should not be omitted (all you guys already know that ofcourse).

Would patches that clean up stuff like that be appreciated or am I just 
wasting my time?
Should I just adopt an 'if gcc -Wall does not complain then it's ok' 
attitude and leave this stuff alone?


Best regards,
Jesper Juhl - juhl@eisenstein.dk



^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [PATCH] pedantic code cleanup - am I wasting my time with this?
@ 2001-04-24  8:25 Stephen Satchell
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Satchell @ 2001-04-24  8:25 UTC (permalink / raw)
  To: linux-kernel

At 05:58 PM 4/23/01 +0200, you wrote:
>>On Mon, Apr 23, 2001 at 05:26:27PM +0200, Jesper Juhl wrote:
>>>last entry should not have a trailing comma.
>>Sadly not.  This isn't a gcc thing: ANSI says that trailing comma is ok (K&R
>>Second edition, A8.7 - pg 218 &219 in my copy)
>
>You are right, I just consulted my own copy, and nothing strictly forbids 
>the comma... Sorry about that, I should have been more thorough before 
>reporting that one...

 From the X3J11 Rationale document, paraphrase:  The inclusion of optional 
trailing commas is to ease the task of generating code by automatic 
programs such as LEX and YACC.

Satch


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

end of thread, other threads:[~2001-04-24  8:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-23 15:26 [PATCH] pedantic code cleanup - am I wasting my time with this? Jesper Juhl
2001-04-23 15:24 ` Jeff Garzik
2001-04-23 15:37 ` Richard Gooch
2001-04-23 16:23   ` Jesper Juhl
2001-04-23 15:48 ` Sean Hunter
2001-04-23 15:58   ` Jesper Juhl
2001-04-24  4:59 ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2001-04-24  8:25 Stephen Satchell

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