Mike Hommey
unread,Oct 30, 2012, 2:23:21 AM10/30/12You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Gregory Szorc, Nicholas Nethercote, Ehsan Akhgari, dev-pl...@lists.mozilla.org, rob...@ocallahan.org
On Mon, Oct 29, 2012 at 06:11:04PM -0700, Gregory Szorc wrote:
> On 10/29/12 5:52 PM, Robert O'Callahan wrote:
> >On Tue, Oct 30, 2012 at 1:13 PM, Nicholas Nethercote <
n.neth...@gmail.com
> >>wrote:
> >
> >>"#pragma once does have one drawback (other than being non-standard)
> >>and that is if you have the same file in different locations (we have
> >>this because our build system copies files around) then the compiler
> >>will think these are different files"
> >>
> >>Is that a problem for Mozilla code?
> >>
> >
> >It could be. On Windows files get copied from the source directory to
> >dist/include. So it seems to me that if "." is on the include path before
> >dist/include, it would be easy for some files to be included twice.
Include path order doesn't even need to be involved. See below.
> In my ideal world, all include paths (actually, all paths given to
> the compiler) are absolute, not relative. This is ideal because it
> saves the build system from requiring execution within a specific
> directory. This simplifies implementation and avoids ambiguity. It
> also has the nice side-effect that you can execute compiler commands
> from anywhere and it just works.
>
> So, if part of this transition is normalizing all include paths to
> absolute paths, +1 from me.
It's not a problem of include paths being absolute or not, it's a
problem of files of identical content but with different inode being
included. A typical case would be:
Foo.cpp:
#include "Bar.h"
#include "mozilla/Foo.h"
Bar.h:
#include "Foo.h"
with Foo.h, Bar.h and Foo.cpp in the same source directory, and
mozilla/Foo.h is Foo.h, installed in dist/include/mozilla.
In such cases, that you use -I. or -I/full/path/to/the/src/dir doesn't
change anything.
Mike