[PATCH] D101331: hurd: Detect libstdc++ include paths on Debian Hurd i386

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 26 17:27:40 PDT 2021


MaskRay added a subscriber: thakis.
MaskRay added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:3014
                                       llvm::opt::ArgStringList &CC1Args) const {
-  addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args);
+  if (!GCCInstallation.isValid())
+    return;
----------------
I'd be glad if we could use `GCCInstallation.isValid()`.

However, @thakis has a chromium usage where `lib/gcc/$triple/crtbegin.o` is not provided while compile-only  libstdc++ search paths are expected.

For now, use `GCCInstallation.isValid() ? GCCInstallation.getTriple().str() : ""`


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:3018
+  StringRef TripleStr = GCCInstallation.getTriple().str();
+
+  addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args, TripleStr);
----------------
No need for a blank line


================
Comment at: clang/test/Driver/hurd.cpp:9
+/// though the installation is i686-gnu.
+// CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-gnu/4.6.0/../../../../include/c++/4.6.0"
+// CHECK-SAME: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-gnu/4.6.0/../../../../include/i386-gnu/c++/4.6.0"
----------------
Windows may use backslashes in some places.
It is really difficult to tell where need backslashes, so I just add `UNSUPPORTED: system-windows` to linux-cross.cpp


================
Comment at: clang/test/Driver/hurd.cpp:21
+// CHECK-SAME: "-L[[SYSROOT]]/usr/lib/gcc/i686-gnu/4.6.0"
+// CHECK-SAME: "-L[[SYSROOT]]/usr/lib/gcc/i686-gnu/4.6.0/../../../../lib32"
+// CHECK-SAME: "-L[[SYSROOT]]/lib/i386-gnu"
----------------
`{{^}} ` is important, otherwise a new addition cannot be detected.


================
Comment at: clang/test/Driver/hurd.cpp:5
+// RUN:   | FileCheck --check-prefix=CHECK %s
+// CHECK-NOT: warning:
+// CHECK: "-cc1"
----------------
sthibaul wrote:
> MaskRay wrote:
> > The warning negative pattern doesn't really work.
> You mean because it was misplaced?
> Indeed, fixed so.
`-###` cannot detect unused warning options: `clang -Wfoobar '-###' a.cc -c` =>  no warning

It is probably not the test's task to check it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101331/new/

https://reviews.llvm.org/D101331



More information about the cfe-commits mailing list