lkml.org 
[lkml]   [2006]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[PATCH/RFC] remove duplicate #includes, take II

Andrew! Folks!

after the response to the first (cruel?) approach
here is a different one (probably as incomplete
and imperfect as the previous, but it seems that
there is a solution in reach)

this time I utilized the checkincludes.pl script
to identify and automatically remove duplicates.
this was done with the following command sequence:

find . -type f -name '*.[hcS]' \
-exec scripts/checkincludes.pl {} \; \
| gawk -F"[: ]" '
{ printf "egrep -nH \"#\\W*include\\W*<%s>\" %s\n",$3,$1 }' \
| sh \
| gawk -F: '{ X[$1]=$2; }
END { for (i in X) printf "%s %d\n",i, X[i] }' \
| gawk '{ printf "mv %s %s.orig && sed -ne \"%dd;p\" %s.orig >%s && echo %s\n",$1,$1,$2,$1,$1,$1; }' \
| sh

which basically executes checkincludes.pl on all
.c, .h and .S files, then greps for '<'*'>' type
includes (to avoid the "*" type ones, which are
usually local includes) and then removes the last
occurence of the identified include from the file

I then splitted it into three categories:

A) probably correct
B) probably wrong
C) definitely wrong

so if folks want to cherry pick and/or comment on
the first two categories, please do so, I will
collect all the feedback and produce a patch to
get rid of the duplicates later ...

best,
Herbert

-
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/

\
 
 \ /
  Last update: 2006-02-18 15:57    [W:0.036 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site