[PATCH/RFC] remove duplicate #includes, take II

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux