[PATCH] D137043: [clang] add implicit include for Linux/gnu compatibility

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 07:47:37 PST 2022


aaron.ballman edited reviewers, added: clang-vendors; removed: mibintc.
aaron.ballman added a comment.

(Removed @mibintc because she retired, added clang-vendors because this can impact other downstreams.)

This is outside my wheelhouse, so I don't have many technical comments to add. I'm hoping @erichkeane and @jyknight can weigh in given how active they were on the earlier thread.



================
Comment at: clang/docs/ReleaseNotes.rst:401-402
   ``#pragma clang __debug sloc_usage`` can also be used to request this report.
+- Clang will implicitly add ``#include "stdc-predef.h"`` on musl-based system 
+  likes GCC.
 
----------------



================
Comment at: clang/lib/Driver/ToolChains/Linux.cpp:640
+
+  // add implict include for musl-based non-free-standing system
+  if (!DriverArgs.hasArg(options::OPT_ffreestanding) && getTriple().isMusl()) {
----------------



================
Comment at: clang/test/Driver/stdc-predef.c:4
+
+// Musl-based system need this addition include.
+//
----------------



================
Comment at: clang/test/Driver/stdc-predef.c:11
+
+// Gnu-based system does not need this addition include.
+//
----------------



================
Comment at: clang/test/Driver/stdc-predef.c:18
+
+// Standalone system does not need this addition include.
+//
----------------



================
Comment at: clang/test/Driver/stdc-predef.c:25-26
+
+// Because this behavior is implemented by adding preprocessor flags in the 
+// driver, so if we disabled preprocess, the include flag should not appear.
+//
----------------



================
Comment at: clang/test/Driver/stdc-predef.c:33-34
+
+// This behavior should appear in all languages that use the c preprocessor,
+// including C, C++ and Objective-C, as long as the system uses musl.
+//
----------------
What about Fortran?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137043/new/

https://reviews.llvm.org/D137043



More information about the cfe-commits mailing list