[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0612171301020.24836@localhost.localdomain>
Date: Sun, 17 Dec 2006 13:13:59 -0500 (EST)
From: "Robert P. J. Day" <rpjday@...dspring.com>
To: Tim Schmielau <tim@...sik3.uni-rostock.de>
cc: Jan Engelhardt <jengelh@...ux01.gwdg.de>,
Stefan Richter <stefanr@...6.in-berlin.de>,
Zach Brown <zach.brown@...cle.com>,
Linux kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: lots of code could be simplified by using ARRAY_SIZE()
so here's the end result of my experiment to replace unnecessary
code snippets with an invocation of the ARRAY_SIZE() macro from
include/linux/kernel.h. i've attached the script that i ran on the
entire tree, then (after adding al viro's connector patch), did:
$ make allyesconfig # for the stress factor
$ make
to see what would happen.
amazingly, the compile worked all the way down to:
AS arch/i386/boot/bootsect.o
LD arch/i386/boot/bootsect
AS arch/i386/boot/setup.o
LD arch/i386/boot/setup
AS arch/i386/boot/compressed/head.o
CC arch/i386/boot/compressed/misc.o
OBJCOPY arch/i386/boot/compressed/vmlinux.bin
HOSTCC arch/i386/boot/compressed/relocs
arch/i386/boot/compressed/relocs.c: In function 'sym_type':
arch/i386/boot/compressed/relocs.c:72: warning: implicit declaration of function 'ARRAY_SIZE'
/tmp/ccRTpFxM.o: In function `main':
relocs.c:(.text+0xb13): undefined reference to `ARRAY_SIZE'
relocs.c:(.text+0xddb): undefined reference to `ARRAY_SIZE'
relocs.c:(.text+0xe10): undefined reference to `ARRAY_SIZE'
relocs.c:(.text+0xe2b): undefined reference to `ARRAY_SIZE'
collect2: ld returned 1 exit status
make[2]: *** [arch/i386/boot/compressed/relocs] Error 1
make[1]: *** [arch/i386/boot/compressed/vmlinux] Error 2
make: *** [bzImage] Error 2
not surprisingly, the diff is fairly sizable (2408 lines), and
that's *way* outside of my comfort zone in terms of what i would
submit as a patch. others higher up the food chain can decide if they
want to do anything with this. (for the information value, i also
attached the "diffstat" output.)
at this point, i think it's someone else's call.
rday
p.s. clearly, this didn't even hit all of the possible
transformations, such as the ones based on typedefs, or even the ones
that are broken over two lines. you can see from the script that i
just went after the low-hanging fruit.
p.p.s. i didn't bother fixing relocs.c yet to see if the build would
actually finish. i thought i'd better stop here and wait to hear what
others think.
Download attachment "arraysize.sh" of type "APPLICATION/x-sh" (1472 bytes)
View attachment "array_size.ds" of type "TEXT/PLAIN" (7293 bytes)
Powered by blists - more mailing lists