Messages in this thread | | | Subject | Re: [PATCH] Re: 2.5.3-pre1 compile error | From | Peter Osterlund <> | Date | 16 Jan 2002 19:32:38 +0100 |
| |
Dave Jones <davej@suse.de> writes:
> On Tue, Jan 15, 2002 at 04:41:08PM -0800, Linus Torvalds wrote: > > > #ifndef _LINUX_POSIX_TYPES_H /* __FD_CLR */ > > > #include <linux/posix_types.h> > > > #endif > > If this actally makes any noticeable difference to compilation speed I > > could live with it. Does it? > > I'm sure I read somewhere that gcc is clever enough to know > when it hits a #include, it checks for a symbol equal to a > mangled version of the filename before including it. > (Ie, doing this transparently). > > Then again, I may have imagined it all.
Not exactly, but there is an optimization in cpp that makes it possible to do the cleanup Linus wants without sacrificing performance. From the cpp info pages:
The GNU C preprocessor is programmed to notice when a header file uses this particular construct and handle it efficiently. If a header file is contained entirely in a `#ifndef' conditional, modulo whitespace and comments, then it remembers that fact. If a subsequent `#include' specifies the same file, and the macro in the `#ifndef' is already defined, then the directive is skipped without processing the specified file at all.
I did an strace on cpp to verify that this optimization actually works.
-- Peter Osterlund - petero2@telia.com http://w1.894.telia.com/~u89404340 - 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/
| |