I was undertaking to sanitize slashes as path separators on Windows.
That is, only supporting \ rather than /.
I would prefer to only support \ (rather than both \ and /) because of
the use of hashes containing filenames, and it feels a bit cleaner to
require only one or the other. It seems more natural to support \ on
Windows for interacting with other tools.
Does anyone agree/disagree with that as a general idea?
The main changes involved are modifying the canonicalization
functions, the associated test data, and ensuring that the dependency
helper always outputs in the correct style. I haven't tried this yet,
but I think I would like to explicitly disallow / in filenames at the
input level to avoid confusion too.
There's a commit here to see the general scope of this
https://github.com/sgraham/ninja/commit/dbd555ad41141e7abc916d0ce32f1533d0e17050
(I unfortunately changed line endings on some files so the diff is
bigger than it should be).
The overall motivation here is to stat in a more reasonable amount of
time on Windows. To do so, stating needs to be done on a directory
level, not a file level (see stat_cache.cc). And, if Nodes are stored
with consistent slashes, then the mtimes that come out of walking the
directory tree can be pushed into the Nodes more easily.
scott
If you are only speaking about the Windows port, then it sounds
reasonable to me. FYI, other project, like cmake, tend to support
slashes everywhere and do the substitution for you. But I think it is
not an option for Ninja to do the substitution.
-Nico
>
> The main changes involved are modifying the canonicalization
> functions, the associated test data, and ensuring that the dependency
> helper always outputs in the correct style. I haven't tried this yet,
> but I think I would like to explicitly disallow / in filenames at the
> input level to avoid confusion too.
>
> There's a commit here to see the general scope of this
> https://github.com/sgraham/ninja/commit/dbd555ad41141e7abc916d0ce32f1533d0e17050
> (I unfortunately changed line endings on some files so the diff is
> bigger than it should be).
>
> The overall motivation here is to stat in a more reasonable amount of
> time on Windows. To do so, stating needs to be done on a directory
> level, not a file level (see stat_cache.cc). And, if Nodes are stored
> with consistent slashes, then the mtimes that come out of walking the
> directory tree can be pushed into the Nodes more easily.
>
> scott
--
Nicolas Desprès
Yes, I only meant for Windows. Non-Windows would still be '/' only of course.
thanks
GNU ld/gold requires backslash escaping for response files. From ld(1),
>> Options in file are separated by whitespace.
>> A whitespace character may be included in
>> an option by surrounding the entire option in
>> either single or double quotes. Any character
>> (including a backslash) may be included by
>> prefixing the character to be included with a backslash.
So what we need is something like rspfile_escape = true or
rspfile_style = backslash option(I hope it is the last option specific
to response file..).
Normalizing backslashes to slash would overcome this situation; we
won't need to add rspfile_escape option _for_filenames_ , but other
parameters like gcc -DVERSION=\\"some\ string\\" are cannot be
normalized.
So i think we still need the rspfile_escape option.
-- oku
arm-linux-androideabi-g++.exe -MMD -MT 3rdparty\tbb.dir\tbb40_20111130oss\src\tbb\arena.cpp.o -MF 3rdparty\tbb.dir\tbb40_20111130oss\src\tbb\arena.cpp.o.d -o 3rdparty\tbb.dir\tbb40_20111130oss\src\tbb\arena.cpp.o -c 3rdparty\tbb\tbb40_20111130oss\src\tbb\arena.cpp
#include "../rml/include/rml_tbb.h"
3rdparty\tbb\tbb40_20111130oss\src\tbb\/../rml/include/rml_tbb.h \
Do you use response files when using gold?
I'm surprised they're needed.
> Normalizing backslashes to slash would overcome this situation; we
> won't need to add rspfile_escape option _for_filenames_ , but other
> parameters like gcc -DVERSION=\\"some\ string\\" are cannot be
> normalized.
> So i think we still need the rspfile_escape option.
Ugh, what a mess. :~(
Ah, of course we only need "escaped" response files when we are using
MinGW or any gcc cross compiler on Windows.
I'm also trying to use Ninja with Android NDK.
-- oku
This was my suggestion before too, but I've (mostly) come around to
viewing the case you mention above as a gcc bug, at least as far as
ninja is concerned.
In my current branch I've wrapped dependency output to more
aggressively normalize lists of headers to \, and made sure that all
paths in the generator match as well. Realistically, it's necessary to
normalize case anyway too, so there has to be a post-process in any
case.
I'm not sure this is the best solution, I just thought I'd mention it.
Evan's "deplist" branch has the deplist helper which parses cl.exe's
/showIncludes output, and gcc .d files. I'm not sure if it normalizes
in that branch, but it does seem like a good place to make everything
"clean and tidy" for ninja anyway. That's where I do the normalize in
the Windows dep_database version.
>
> By the way I've tried your branch and it works well for me. The only issue
> was that bootstraper script doesn't work in your branch (version.h is not
> generated for bootstrap.py and linker fails with duplicated declarations of
> "main" added by the utilities).
Glad to hear. Sorry about the broken bootstrap, should be fixed now.