[PATCH] D34158: to support gcc 4.8 (and newer) compatibility on Linux, preinclude <stdc-predef.h>

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 13:27:56 PDT 2017

mibintc updated this revision to Diff 104911.
mibintc added a subscriber: ilya-biryukov.
mibintc added a comment.

The previous (n-1) version didn't work: I wanted to iterate through the system include directories to check for the existence of stdc-predef.h but clang is using a different kind of system include option for /usr and /usr/include so the iterator didn't find any system includes at all, i don't think there is an iterator which will iterate through these special kind of include directories. [Kind of embarrassing that I posted that patch which didn't work at all, sorry about that.]

This one behaves more like gcc anyway. gcc puts the -include option in there regardless, and to suppress the behavior you are to use the -ffreestanding option.

I responded to the remarks from Jonas Hahnfeld, making the patch only for Linux.

I'm having trouble with one of the existing tests. These are the ones that fail. I don't know how to fix the text. It's a google test and it is using a dummy file system with whitelisted directories. @ilya-biryukov Is there a way to pass in a command line argument? if so, I could fix it these failures by adding -ffreestanding option which suppresses the new behavior. That's how I fixed the many test failures which I encountered with this new behavior.

  Extra Tools Unit Tests :: clangd/ClangdTests/ClangdVFSTest.Parse
  Extra Tools Unit Tests :: clangd/ClangdTests/ClangdVFSTest.ParseWithHeader
  Extra Tools Unit Tests :: clangd/ClangdTests/ClangdVFSTest.Reparse

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.

Failing Tests (4): -- the 3 listed above, as well as

  Clang :: Driver/gcc-predef.c -- my new test, the 3rd run which confirms that the include is added




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34158.104911.patch
Type: text/x-patch
Size: 25159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170630/946c22cb/attachment-0001.bin>

More information about the cfe-commits mailing list