lkml.org 
[lkml]   [2002]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] Re: 2.5.3-pre1 compile error
    From
    Date
    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/

    \
     
     \ /
      Last update: 2005-03-22 13:23    [W:0.035 / U:0.772 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site