public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] remove duplicate #includes, take II
@ 2006-02-18 14:55 Herbert Poetzl
  2006-02-18 14:57 ` [PATCH/RFC] remove duplicate #includes, take II, A Herbert Poetzl
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Herbert Poetzl @ 2006-02-18 14:55 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux Kernel ML, Bastian Blank, Arthur Othieno, Jean Delvare,
	Russell King


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-19 23:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-18 14:55 [PATCH/RFC] remove duplicate #includes, take II Herbert Poetzl
2006-02-18 14:57 ` [PATCH/RFC] remove duplicate #includes, take II, A Herbert Poetzl
2006-02-18 14:58 ` [PATCH/RFC] remove duplicate #includes, take II, part B Herbert Poetzl
2006-02-19  0:19   ` Russell King
2006-02-18 14:59 ` [PATCH/RFC] remove duplicate #includes, take II, part C Herbert Poetzl
2006-02-19 23:47 ` [PATCH/RFC] remove duplicate #includes, take II Benjamin LaHaise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox