Recent GN sources require newer C++23 compiler and standard library
support, which causes host-build failures on systems using older Clang
or libstdc++ versions.
Add compatibility handling for older host toolchains:
* use std::unique() instead of std::ranges::unique() when building with
libstdc++ versions older than 13
* use -std=c++2b for Clang versions older than 17
* work around lambda captures of structured bindings on Clang versions
older than 16
* retain the upstream implementation for newer compilers and standard
libraries
This fixes GN host builds on systems using older Clang together with
GCC 12 libstdc++ without changing behavior on newer toolchains.
Support defined(foo["bar"]) syntax.
Since it is already possible to use a string subscript to
get the value of a scope member (i.e. foo["bar"] being the
same as foo.bar, but [] allowing expression evaluation),
this ensures that `defined(foo["bar"])` works as `defined(foo.bar)`
as well.
Since it is already possible to use a string subscript to
get the value of a scope member (i.e. foo["bar"] being the
same as foo.bar, but [] allowing expression evaluation),
this ensures that `defined(foo["bar"])` works as `defined(foo.bar)`
as well.
The wrong escaping mode is used in a few contexts, which results in
failed builds. This is happening in particular to folks whose sources
are inside a directory with a space in it, and whose builds are not
contained within that directory.
Such builds encode the surrounding filesystem structure into the ninja
files, which is unfortunate but unavoidable in some environments. Fix
the escaping mode in this case.
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>