For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is available
authorErich Keane <erich.keane@intel.com>
Mon, 11 Dec 2017 17:36:42 +0000 (17:36 +0000)
committerErich Keane <erich.keane@intel.com>
Mon, 11 Dec 2017 17:36:42 +0000 (17:36 +0000)
commitbb322555afb4fb135abc48fbb3383b7216557995
tree782f5e3b1f233605be86108c24fa62f3b624261e
parent63fcc5cccc8aa124858a9a79e275bdc5955bf5c0
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
24 files changed:
clang/include/clang/Driver/CC1Options.td
clang/include/clang/Lex/PreprocessorOptions.h
clang/lib/Driver/Job.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Driver/ToolChains/Linux.h
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h [new file with mode: 0644]
clang/test/Driver/crash-report-header.h
clang/test/Driver/crash-report-spaces.c
clang/test/Driver/crash-report.c
clang/test/Driver/rewrite-map-in-diagnostics.c
clang/test/Driver/stdc-predef.c [new file with mode: 0644]
clang/test/Driver/stdc-predef.i [new file with mode: 0644]
clang/test/Index/IBOutletCollection.m
clang/test/Index/annotate-macro-args.m
clang/test/Index/annotate-tokens-pp.c
clang/test/Index/annotate-tokens.c
clang/test/Index/c-index-getCursor-test.m
clang/test/Index/get-cursor-macro-args.m
clang/test/Index/get-cursor.cpp
clang/test/Preprocessor/ignore-pragmas.c
clang/unittests/Tooling/TestVisitor.h
clang/unittests/libclang/LibclangTest.cpp