diff options
| author | Erich Keane <erich.keane@intel.com> | 2017-12-11 17:36:42 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2017-12-11 17:36:42 +0000 |
| commit | bb322555afb4fb135abc48fbb3383b7216557995 (patch) | |
| tree | 782f5e3b1f233605be86108c24fa62f3b624261e /clang/unittests | |
| parent | 63fcc5cccc8aa124858a9a79e275bdc5955bf5c0 (diff) | |
| download | bcm5719-llvm-bb322555afb4fb135abc48fbb3383b7216557995.tar.gz bcm5719-llvm-bb322555afb4fb135abc48fbb3383b7216557995.zip | |
For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is available
As reported in llvm bugzilla 32377.
Here’s a patch to add preinclude of stdc-predef.h.
The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html;
The preinclude is inhibited with –ffreestanding.
Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior.
I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here
Note: this is a recommit after a test failure took down the original (r318669)
Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D34158
llvm-svn: 320391
Diffstat (limited to 'clang/unittests')
| -rw-r--r-- | clang/unittests/Tooling/TestVisitor.h | 1 | ||||
| -rw-r--r-- | clang/unittests/libclang/LibclangTest.cpp | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/unittests/Tooling/TestVisitor.h b/clang/unittests/Tooling/TestVisitor.h index fb6a76ccadd..e7e57d184ed 100644 --- a/clang/unittests/Tooling/TestVisitor.h +++ b/clang/unittests/Tooling/TestVisitor.h @@ -52,6 +52,7 @@ public: /// \brief Runs the current AST visitor over the given code. bool runOver(StringRef Code, Language L = Lang_CXX) { std::vector<std::string> Args; + Args.push_back("-ffreestanding"); switch (L) { case Lang_C: Args.push_back("-x"); diff --git a/clang/unittests/libclang/LibclangTest.cpp b/clang/unittests/libclang/LibclangTest.cpp index f2a96d6be6c..98c2ad16a33 100644 --- a/clang/unittests/libclang/LibclangTest.cpp +++ b/clang/unittests/libclang/LibclangTest.cpp @@ -434,8 +434,10 @@ TEST_F(LibclangParseTest, AllSkippedRanges) { "#ifdef KIWIS\n" "printf(\"mmm!!\");\n" "#endif"); + const char *Args[] = { "-ffreestanding" }; + int NumArgs = sizeof(Args) / sizeof(Args[0]); - ClangTU = clang_parseTranslationUnit(Index, Main.c_str(), nullptr, 0, + ClangTU = clang_parseTranslationUnit(Index, Main.c_str(), Args, NumArgs, nullptr, 0, TUFlags); CXSourceRangeList *Ranges = clang_getAllSkippedRanges(ClangTU); |

