[BusyBox] Re: ifconfig: Clean up. [PATCH]
Rob Landley
rob at landley.net
Mon Jul 25 02:23:00 UTC 2005
On Sunday 24 July 2005 21:08, Jason Schoon wrote:
> I agree about reducing the ifdefs, but I always feel a bit leery about
> relying on the compiler to remove dead code. This isn't relevent for
> Busybox, but in my other code I always use lint, which throws annoying
> warnings on things like that.
Busybox isn't 100% Linux dependent, but we generally assume a roughly
equivalent build environment. The Linux kernel relies _heavily_ on dead code
elimination instead of #ifdefs, and any compiler created in the last 20 years
should be capable of doing dead code elimination. (Heck, even TCC can do it
now.)
And yes, people have come to rely on this, the Linux kernel case in point, but
by no means the only one. Any Lint tool so old and decrepit it doesn't
understand that people actually _use_ widely available compiler features
isn't necessarily all that useful anymore. (I could still be convinced
either way, but I know where I'm leaning...)
Lint should have a "dead code is OK" flag. Or you could run a lint on
"allyesconfig"...
> I would vote for a macro such as DO_CLEANUP(a) that simply evaluated
> to nothing if cleanup is not defined, and call it unconditionally
> wherever needed.
And you handle multi-line blocks how? (It's an option, I suppose. But
if(flag) {optional_stuff();} is very straightforward C. A macro, not so
much.)
One of the things I'm wondering about is the sed free_and_close_stuff()
function, for example. In theory, since it's marked static it should be
eliminated if it's never called within the current file. I practice, I
haven't tried it...
Rob
More information about the busybox
mailing list