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

2021-01-26 Thread Jeff Muizelaar via Phabricator via cfe-commits
jrmuizel added a comment.

Actually, this may just be a local configuration issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83250

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2021-01-26 Thread Jeff Muizelaar via Phabricator via cfe-commits
jrmuizel added a comment.

This seems to have broken compilation for me on 10.15.

The stdio.h from the 10.15 SDK there's the following usage:

  #if TARGET_OS_EMBEDDED
  #define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
  #else
  #define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg)
  #endif


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83250

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-07-06 Thread Zixu Wang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf47b8851318d: [clang] Enable errors for undefined TARGET_OS_ 
macros in Darwin driver (authored by zixuw).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83250

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/darwin-warning-options.c


Index: clang/test/Driver/darwin-warning-options.c
===
--- /dev/null
+++ clang/test/Driver/darwin-warning-options.c
@@ -0,0 +1,7 @@
+// REQUIRES: system-darwin
+
+// Always error about undefined 'TARGET_OS_*' macros on Darwin.
+// RUN: %clang -### %s 2>&1 | FileCheck %s
+
+// CHECK-DAG: "-Wundef-prefix=TARGET_OS_"
+// CHECK-DAG: "-Werror=undef-prefix"
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 ) 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


Index: clang/test/Driver/darwin-warning-options.c
===
--- /dev/null
+++ clang/test/Driver/darwin-warning-options.c
@@ -0,0 +1,7 @@
+// REQUIRES: system-darwin
+
+// Always error about undefined 'TARGET_OS_*' macros on Darwin.
+// RUN: %clang -### %s 2>&1 | FileCheck %s
+
+// CHECK-DAG: "-Wundef-prefix=TARGET_OS_"
+// CHECK-DAG: "-Werror=undef-prefix"
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 ) 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-07-06 Thread Zixu Wang via Phabricator via cfe-commits
zixuw updated this revision to Diff 275821.
zixuw added a comment.

Add a test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83250

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/darwin-warning-options.c


Index: clang/test/Driver/darwin-warning-options.c
===
--- /dev/null
+++ clang/test/Driver/darwin-warning-options.c
@@ -0,0 +1,7 @@
+// REQUIRES: system-darwin
+
+// Always error about undefined 'TARGET_OS_*' macros on Darwin.
+// RUN: %clang -### %s 2>&1 | FileCheck %s
+
+// CHECK-DAG: "-Wundef-prefix=TARGET_OS_"
+// CHECK-DAG: "-Werror=undef-prefix"
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 ) 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


Index: clang/test/Driver/darwin-warning-options.c
===
--- /dev/null
+++ clang/test/Driver/darwin-warning-options.c
@@ -0,0 +1,7 @@
+// REQUIRES: system-darwin
+
+// Always error about undefined 'TARGET_OS_*' macros on Darwin.
+// RUN: %clang -### %s 2>&1 | FileCheck %s
+
+// CHECK-DAG: "-Wundef-prefix=TARGET_OS_"
+// CHECK-DAG: "-Werror=undef-prefix"
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 ) 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-07-06 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Please add a test-case as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83250



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-07-06 Thread Zixu Wang via Phabricator via cfe-commits
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 ) 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


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 ) 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits