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/