[PATCH] D141206: [clang] [MinGW] Avoid adding <base>/include and <base>/lib when cross compiling
Alvin Wong via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 10:14:11 PST 2023
alvinhochun added inline comments.
================
Comment at: clang/test/Driver/mingw-sysroot.cpp:25-38
// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s
// CHECK_TESTROOT_GCC: "-internal-isystem" "[[BASE:[^"]+]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++"
// CHECK_TESTROOT_GCC-SAME: {{^}} "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32"
// CHECK_TESTROOT_GCC-SAME: {{^}} "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward"
// CHECK_TESTROOT_GCC: "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}g++-v10.2-posix"
// CHECK_TESTROOT_GCC: "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}g++-v10.2"
// CHECK_TESTROOT_GCC: "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}g++-v10"
----------------
mstorsjo wrote:
> alvinhochun wrote:
> > I think this only verifies that the include path is not present after the last `CHECK_TESTROOT_GCC` match. The [[ https://llvm.org/docs/CommandGuide/FileCheck.html#cmdoption-filecheck-implicit-check-not | --implicit-check-not ]] option should be used to check that the pattern is not present anywhere in the output.
> Right - that's true (although this is the spot where the entry did appear before - I checked that the test did fail before applying the functional change).
>
> I tried adding `--implicit-check-not` here, but the quoting/escaping of the regexes seems tricky - even getting it to recognize the literal quotes surrounding the string.
>
> I tried with `--implicit-check-not="\"{{.*}}/testroot-gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include\""`, but that's not working (i.e. it's not detecting anything even when I remove the functional change of the patch). With a trivial reduction of it, into `--implicit-check-not="testroot-gcc/x86_64-w64-mingw32/include"`, it's detecting things as expected (but that quote gets handled by the shell, so this would match any substring, such as `.../include/subdir` too. But even `--implicit-check-not="testroot-gcc/x86_64-w64-mingw32/include\""` does not match correctly.
>
> The documentation says that the `--implicit-check-not` option does take a pattern, but it doesn't really say what's allowed in that pattern - apparently not the full syntax used in normal `CHECK` lines at least...
Maybe it's a problem with escaping those backslashes? I think the command line is interpreted by lit which has its own escaping rules.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141206/new/
https://reviews.llvm.org/D141206
More information about the cfe-commits
mailing list