[lkml]   [2001]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] More compile warning fixes for 2.4.0
On Sun, 07 Jan 2001 07:41:57 -0500, 
Paul Gortmaker <> 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).
> -----------------------------8<-----------8<------------------------
>for i in `find . -type f -name '*.[chS]'`
> 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
> -----------------------------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
Please read the FAQ at

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