lkml.org 
[lkml]   [2008]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
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

\
 
 \ /
  Last update: 2008-12-09 18:03    [W:0.360 / U:0.192 seconds]
©2003-2014 Jasper Spaans. Advertise on this site