lkml.org 
[lkml]   [2003]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Linux 2.6.0-test6
    Linus Torvalds wrote:
    > On Sun, 28 Sep 2003, Sam Ravnborg wrote:
    > > Would it help to require all major[1] header files to include all the
    > > header files needed for them to compile?
    >
    > It causes tons of extra work for the compiler if the compiler doesn't
    > optimize away redundant header files (same header file being included from
    > a lot of different sources).
    >
    > I did the pruning in sparse, and I think at least gcc-3 does it too, but
    > I'm not sure.

    GCC does optimise away multiple header file inclusion, and has done
    for a very long time, oh a decade or so :)

    GCC will not reparse a header file if these conditions are met:

    1. The file has already been parsed at least once.

    2. Apart from comments, the entire file is surrounded by
    "#ifndef symbol ... #endif" or "#if !defined (symbol) ... #endif".

    3. "symbol" is defined.

    4. The file names are the same after removal of "." and ".." components
    and other path simplifications.

    > If so, then sure, we could just require that the header files compile
    > cleanly, and for extra points verify that the end result is an empty
    > object file (ie no bad declarations anywhere..).

    You can also use the "-H" option and check for a "Multiple include
    guards may be useful for:" message, to check those #ifndefs.

    -- Jamie
    -
    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:48    [W:0.023 / U:296.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site