Re: [PATCH] sched/cputime: silence a -Wunused-function warning

From: Joe Perches
Date: Fri Mar 06 2020 - 14:12:32 EST


On Fri, 2020-03-06 at 11:02 -0800, Nick Desaulniers wrote:
> On Fri, Mar 6, 2020 at 10:39 AM Joe Perches <joe@xxxxxxxxxxx> wrote:
[]
> > Turns out there are hundreds of unused static inline
> > functions in kernel .h files.
> >
> > A trivial script to find some of them (with likely
> > false positives as some might actually be used via ##
> > token pasting mechanisms).
> >
> > (and there's almost certainly a better way to do this
> > too as it takes a _very_ long time to run)
> >
> > $ grep-2.5.4 -rP --include=*.h '^[ \t]*static\s+inline\s+(?:\w+\s+){1,3}\w+[ \t]*\(' * | \
> > grep -P -oh '\w+\s*\(' | \
> > sort | uniq -c | sort -n | grep -P '^\s+1\b' | \
> > sed -r -e 's/^\s+1\s+//' -e 's/\(//' | \
> > while read line ; do \
> > echo -n "$line: " ; git grep -w $line | wc -l ; \
> > done | \
> > grep ": 1$"
>
> Please start sending patches to remove them and I'll review. If this
> is a good amount of work, I have newbies that are looking to
> contribute and can help.

That's not a task I care to take on.

I could run the script and post the results through
if you can not.