[PATCH] D83250: [clang] Enable errors for undefined TARGET_OS_ macros in Darwin driver

Zixu Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 6 12:26:35 PDT 2020


zixuw created this revision.
zixuw added reviewers: arphaman, ributzka.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.

Add clang option `-Wundef-prefix=TARGET_OS_` and `-Werror=undef-prefix`
to Darwin driver.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83250

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp


Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -954,6 +954,10 @@
     : Darwin(D, Triple, Args) {}
 
 void DarwinClang::addClangWarningOptions(ArgStringList &CC1Args) const {
+  // Always error about undefined 'TARGET_OS_*' macros.
+  CC1Args.push_back("-Wundef-prefix=TARGET_OS_");
+  CC1Args.push_back("-Werror=undef-prefix");
+
   // For modern targets, promote certain warnings to errors.
   if (isTargetWatchOSBased() || getTriple().isArch64Bit()) {
     // Always enable -Wdeprecated-objc-isa-usage and promote it


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83250.275796.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200706/89728176/attachment.bin>


More information about the cfe-commits mailing list