Hahnfeld added a comment.

In https://reviews.llvm.org/D34158#797170, @mibintc wrote:

> The other test that fails is my own new test! It fails because I don't know 
> how to set it up so the test thinks it has a gcc toolchain with version > 
> 4.8. I tried using gcc-toolchain set to various other Linux toolchains that i 
> see in the test/Driver/Inputs - none of them cause the gcc version to be in 
> the range. I also tried using -ccc-installation=Inputs/ which I see being 
> used for gcc version parsing. How can I set up the test so that the 
> GCCInstallation has a Version >= 4.8?  I test the new functionality from the 
> console on Linux and can confirm it's working.


You could try adding a completely new directory in `Inputs/`. Add the directory 
`usr/lib/gcc/x86_64-unknown-linux/4.9.0` underneath which //should// be 
recognized as the version. Maybe you have to add some more files, I'm not 
really familiar with the detection mechanism...



================
Comment at: lib/Driver/ToolChains/Gnu.cpp:2332-2343
+void Generic_GCC::addGnuIncludeArgs(const ArgList &DriverArgs, 
+                                    ArgStringList &CC1Args) const {
+  const Generic_GCC::GCCVersion &Version = GCCInstallation.getVersion();
+  if (!DriverArgs.hasArg(options::OPT_ffreestanding) &&
+      !DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) &&
+      !Version.isOlderThan(4, 8, 0)) {
+    // For gcc >= 4.8.x, gcc will preinclude <stdc-predef.h>
----------------
I think this can still be moved to Linux...


================
Comment at: test/Driver/gcc-predef.c:27
+    #if defined( DUMMY_STDC_PREDEF )
+      #error "stdc-predef.h should not be preincluded for gcc < 4.8.x"
+    #endif
----------------
Maybe it's better to run clang with `-###` and checking that it passes 
`-include` to cc1?

Then you can have:
```
// CHECK-PREDEF: "-include" "stdc-predef.h"
// CHECK-NO-PREDEF-NOT: "-include" "stdc-predef.h"
```
and pass the corresponding prefixes to FileCheck. Could you also add a test 
that it the file is not included if it does not exist? This can be done with 
the current `basic_linux_tree`


Repository:
  rL LLVM

https://reviews.llvm.org/D34158



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to