lkml.org 
[lkml]   [2001]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] More compile warning fixes for 2.4.0
Date
On Sun, 07 Jan 2001 07:41:57 -0500, 
Paul Gortmaker <p_gortmaker@yahoo.com> wrote:
>Rich Baum wrote:
>>
>> Here's a patch that fixes more of the compile warnings with gcc
>> 2.97.
>> -#endif __SNMP__
>> +#endif /* __SNMP__ */
>
>Might as well automate it for all of these endif ones through the entire
>kernel (assuming you already haven't of course).
>
>Paul.
> -----------------------------8<-----------8<------------------------
>#!/bin/bash
>for i in `find . -type f -name '*.[chS]'`
>do
> grep -q '^#endif [A-Za-z0-9_]' $i 2>/dev/null
> if [ $? == 0 ]; then
> mv $i $i~
> sed 's/^#endif \([A-Za-z0-9_]\+$\)/#endif \/\* \1 \*\//'<$i~>$i
> fi
>done
> -----------------------------8<-----------8<------------------------

#endif can have white space before '#' and between '#' and 'endif', it
can have tabs instead of spaces, the spurious text is anything that
does not start with '/'. Time to start a new one liner contest ;) ...

find -type f -name '*.[chS]' | xargs perl -lpi -e 's:^(\s*#\s*endif)\s+([^/\s].*)$:\1\t/* \2 */:;'

It even preserves the existing #endif layout. That regexp does not
catch #endif /foo, it assumes that '/' always starts a comment. The
extra complexity to catch that rare case is not worth it. The command
changed 97 files on base 2.4.0.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.097 / U:7.148 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site