[PATCH 0/33] Make static

From: Roel Kluin
Date: Tue Dec 09 2008 - 11:59:54 EST


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