[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
Tue Jun 13 11:57:49 PDT 2017
mibintc created this revision.
mibintc created this object with visibility "All Users".
Herald added subscribers: fedor.sergeev, arichardson, Anastasia, sdardis, klimek.
As reported in llvm bugzilla 32377.
Here’s a patch to add preinclude of stdc-predef.h for gcc >= 4.8
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.
I’m not sure what other toolchains, if any, should support it. I put in some changes for Solaris or MipsLinux but I didn’t debug them and not sure the changes that i slapped in for MipsLinux and Solaris will, or should, work. I could just omit those and let folks interested in the other toolchains to do that, what’s your recommendation for supporting gcc on other platforms besides Linux? I only debugged and verified on Linux. Also, what's the mechanism to restrict the test case to run only on Linux?
Basically I fixed the failing test cases by adding either –ffreestanding or –nostdinc which inhibits this behavior. Some of the tests didn't support -ffreestanding but they did accept -nostdinc. Also, I have a few lit tests failing in my sandbox, they'll need to be updated to accomodate the change in the preprocessing. Anyway, hoping for some feedback on this patch.
in my sandbox, these tests are failing on Linux so currently it's not ready:
Failing Tests (7):
Clang Tools :: clang-tidy/llvm-include-order.cpp
Clang Tools :: clang-tidy/readability-implicit-bool-cast.cpp
Clang Tools :: pp-trace/pp-trace-pragma-general.cpp
Clang Tools :: pp-trace/pp-trace-pragma-opencl.cpp
Extra Tools Unit Tests :: clangd/ClangdTests/ClangdVFSTest.Parse
Extra Tools Unit Tests :: clangd/ClangdTests/ClangdVFSTest.ParseWithHeader
Extra Tools Unit Tests :: clangd/ClangdTests/ClangdVFSTest.Reparse
Repository:
rL LLVM
https://reviews.llvm.org/D34158
Files:
include/clang/Driver/ToolChain.h
lib/Driver/ToolChain.cpp
lib/Driver/ToolChains/Gnu.cpp
lib/Driver/ToolChains/Gnu.h
lib/Driver/ToolChains/Linux.cpp
lib/Driver/ToolChains/Linux.h
lib/Driver/ToolChains/MipsLinux.cpp
lib/Driver/ToolChains/MipsLinux.h
lib/Driver/ToolChains/Solaris.cpp
test/Driver/clang_cpp.c
test/Index/IBOutletCollection.m
test/Index/annotate-macro-args.m
test/Index/annotate-tokens-pp.c
test/Index/annotate-tokens.c
test/Index/c-index-getCursor-test.m
test/Index/get-cursor-macro-args.m
test/Index/get-cursor.cpp
unittests/Tooling/TestVisitor.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34158.102372.patch
Type: text/x-patch
Size: 24975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170613/75c034b2/attachment-0001.bin>
More information about the cfe-commits
mailing list