Re: [TRIVIAL] Designated initializers for i386

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Tue Aug 13 2002 - 22:05:49 EST


In message <20020813231621.O13598@suse.de> you write:
> On Tue, Aug 13, 2002 at 06:18:59PM +1000, Rusty Russell wrote:
> > Sorry for batching these, but there are so damn many.
>
> Do you have many more of these jumbo patchsets pending ?
> I've yet to find a word that sums up just how annoying it is
> to have a bunch of pending patches made totally useless due to
> these largely pointless (for now) patches.

Yes, it's a PITA. I'm slowly working my way through the maintainers,
see my kernel.org web page.

Here is the copy of my sed script, which works pretty well (you still
have to check for screwed up bitfields, ie:
        unsigned long x:5,
        y:1,
        z:2;

The "y:1" line looks like an old-style designated initializer 8(.

Also, this script doesn't catch all of them, but it breaks the back of
the problem, leaving the rest for the janitors.

Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#! /bin/sh # Usage: fix-designated-initializers.sh <filenames>

for f; do # (1) Ignore default: # (2) Ignore lines containing two identifiers in a row but no C keywords, # unless it contains /*, */ or ". # (3) Replace "foo: xxx, /* comment" with ".foo = xxx, /* comment" # (4) Replace "foo: xxx };" with ".foo = xxx };" # (5) Replace "{ foo: xxx" with "{ .foo = xxx" # (6) Lines which match "foo: xxx", grab next line, if it's foo: # xxx\n};, replace. sed -e '/[ ]default:/{p;d;}' \ -e '/[a-zA-Z_][a-zA-Z0-9_]*[ ]\+[a-zA-Z_][a-zA-Z0-9_]*/{/[^a-z]\(auto\|break\|case\|char\|const\|continue\|default\|do\|double\|else\|enum\|extern\|float\|for\|goto\|if\|inline\|int\|long\|register\|restrict\|return\|short\|signed\|sizeof\|static\|struct\|switch\|typedef\|union\|unsigned\|void\|volatile\|while\)[^a-z]/!{/\(\/\*\|\*\/\|"\)/!{p;d;};};}' \ -e '/^\([ ]\+\)\([a-z_]\+\):\([ ]*\)\([^,]*,\)/{s//\1.\2\3= \4/p;d;}' \ -e '/^\([ ]\+\)\([a-z_]\+\):\([ ]*\)\(.*[ ]*};\)/{s//\1.\2\3= \4/p;d;}' \ -e '/\({[ ]\+\)\([a-z_]\+\):\([ ]*\)/{s//\1.\2\3= /p;d;}' \ -e '/^\([ ]\+\)\([a-z_]\+\):\([ ]\+\)\(.*\)/{N;/^\([ ]\+\)\([a-z_]\+\):\([ ]\+\)\([^\n]*\)\(\n[ ]*};\)/{s//\1.\2\3= \4\5/;};}' < $f > $f.new diff -u $f $f.new rm -rf $f.new done

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



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:35 EST