Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 16 Jan 2002 13:33:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 16 Jan 2002 13:32:57 -0500 Received: from mailc.telia.com ([194.22.190.4]:15350 "EHLO mailc.telia.com") by vger.kernel.org with ESMTP id ; Wed, 16 Jan 2002 13:32:47 -0500 To: Dave Jones Cc: Linus Torvalds , David Weinehall , Benjamin LaHaise , John Weber , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Re: 2.5.3-pre1 compile error In-Reply-To: <20020116013811.E5235@khan.acc.umu.se> <20020116015513.L32088@suse.de> From: Peter Osterlund Date: 16 Jan 2002 19:32:38 +0100 In-Reply-To: <20020116015513.L32088@suse.de> Message-ID: Lines: 35 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Dave Jones writes: > On Tue, Jan 15, 2002 at 04:41:08PM -0800, Linus Torvalds wrote: > > > #ifndef _LINUX_POSIX_TYPES_H /* __FD_CLR */ > > > #include > > > #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/