Messages in this thread | | | Date | Tue, 09 Dec 2008 17:53:26 +0100 | From | Roel Kluin <> | Subject | [PATCH 0/33] Make static |
| |
Hi,
The following patches make things static, found by sparse. They are only used in the file where they are declared.
I first compiled the kernel using sparse. and piped output to ../logs/make_yes_log_20081203155529
Then I used the script below, but made some manual changes as well. I tested changes with checkpatch, have built it successfully with allnoconfig, allmodconfig and allyesconfig.
Thanks,
Roel
Q="[^[:alnum:]_]" s="[[:space:]]+" V="[A-Za-z_]+[A-Za-z0-9_]*"
grep "Should it be static\?" ../logs/make_yes_log_20081203155529 | sed -rn "s/^([^:]*):([^:]*):.*'($V)'.*$/\1 \2 \3/p" | while read f n v; do echo "---[ v $f:$n $v ]---" f2="$(git grep -l -E "(^|$Q)$v($Q|$)")" z=$(echo "$f2" | wc -l) if [ $z -eq 1 ]; then echo "$v can be static: v $f:$n" sed -r -i "${n}s/^(static$S)*(.*)$/static \2/" "$f" elif [ $z -lt 5 ]; then grep -E -n "(^|$Q)$v($Q|$)" $(echo $f2 | tr "\n" " "); echo "if this can be static then apply:" echo "sed -r -i \"${n}s/^(static$S)*(.*)$/static \2/\" \"$f\""; fi done | less
| |