Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang] Clean up macOS version flags #95374

Merged
merged 1 commit into from
Jun 16, 2024

Conversation

Xazax-hun
Copy link
Collaborator

@Xazax-hun Xazax-hun commented Jun 13, 2024

The -mmacos-version-min flag is preferred over -mmacosx-version-min. This patch updates the tests and documentation to make this clear and also adds the missing logic to scan build to handle the new flag.

Fixes #86376.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:static analyzer labels Jun 13, 2024
@Xazax-hun Xazax-hun requested review from ldionne and haoNoQ June 13, 2024 08:52
@llvmbot
Copy link
Member

llvmbot commented Jun 13, 2024

@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Gábor Horváth (Xazax-hun)

Changes

The -mmacos-version-min flag is preferred over -mmacosx-version-min. This patch makes updates the tests and documentation to make this clear and also adds the missing logic to scan build to handle the new flag.

Fixes #86376.


Patch is 25.39 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/95374.diff

19 Files Affected:

  • (modified) clang/docs/CommandGuide/clang.rst (+2-2)
  • (modified) clang/docs/LanguageExtensions.rst (+2-2)
  • (modified) clang/include/clang/Driver/ToolChain.h (+1-1)
  • (modified) clang/test/Coverage/targets.c (+1-1)
  • (modified) clang/test/Driver/arc.c (+1-1)
  • (modified) clang/test/Driver/arclite-link.c (+4-4)
  • (modified) clang/test/Driver/darwin-objc-defaults.m (+7-7)
  • (modified) clang/test/Driver/darwin-stdlib-dont-pass-in-c.c (+1-1)
  • (modified) clang/test/Driver/darwin-stdlib.cpp (+3-3)
  • (modified) clang/test/Driver/darwin-version.c (+5-5)
  • (modified) clang/test/Driver/darwin-xarch.c (+2-2)
  • (modified) clang/test/Driver/fsanitize.c (+3-3)
  • (modified) clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp (+2-2)
  • (modified) clang/test/Driver/sanitizer-ld.c (+2-2)
  • (modified) clang/test/Driver/stack-protector.c (+7-7)
  • (modified) clang/test/Index/TestClassForwardDecl.m (+1-1)
  • (modified) clang/test/Index/c-index-api-loadTU-test.m (+1-1)
  • (modified) clang/test/Index/c-index-getCursor-test.m (+1-1)
  • (modified) clang/tools/scan-build/libexec/ccc-analyzer (+1)
diff --git a/clang/docs/CommandGuide/clang.rst b/clang/docs/CommandGuide/clang.rst
index 643365215f875..14400c39e9190 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -362,7 +362,7 @@ number of cross compilers, or may only support a native target.
 
   Specify the architecture to build for (all platforms).
 
-.. option:: -mmacosx-version-min=<version>
+.. option:: -mmacos-version-min=<version>
 
   When building for macOS, specify the minimum version supported by your
   application.
@@ -723,7 +723,7 @@ ENVIRONMENT
 
 .. envvar:: MACOSX_DEPLOYMENT_TARGET
 
-  If :option:`-mmacosx-version-min` is unspecified, the default deployment
+  If :option:`-mmacos-version-min` is unspecified, the default deployment
   target is read from this environment variable. This option only affects
   Darwin targets.
 
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 1b5db388301f7..9830b35faae12 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2064,7 +2064,7 @@ Objective-C @available
 ----------------------
 
 It is possible to use the newest SDK but still build a program that can run on
-older versions of macOS and iOS by passing ``-mmacosx-version-min=`` /
+older versions of macOS and iOS by passing ``-mmacos-version-min=`` /
 ``-miphoneos-version-min=``.
 
 Before LLVM 5.0, when calling a function that exists only in the OS that's
@@ -2085,7 +2085,7 @@ When a method that's introduced in the OS newer than the target OS is called, a
 
   void my_fun(NSSomeClass* var) {
     // If fancyNewMethod was added in e.g. macOS 10.12, but the code is
-    // built with -mmacosx-version-min=10.11, then this unconditional call
+    // built with -mmacos-version-min=10.11, then this unconditional call
     // will emit a -Wunguarded-availability warning:
     [var fancyNewMethod];
   }
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index 9789cfacafd78..1f93bd612e9b0 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -639,7 +639,7 @@ class ToolChain {
 
   /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
   /// target, which may take into account the command line arguments. For
-  /// example, on Darwin the -mmacosx-version-min= command line argument (which
+  /// example, on Darwin the -mmacos-version-min= command line argument (which
   /// sets the deployment target) determines the version in the triple passed to
   /// Clang.
   virtual std::string ComputeEffectiveClangTriple(
diff --git a/clang/test/Coverage/targets.c b/clang/test/Coverage/targets.c
index a0ec2836874a6..15110eadb298e 100644
--- a/clang/test/Coverage/targets.c
+++ b/clang/test/Coverage/targets.c
@@ -14,4 +14,4 @@
 // RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-unknown -emit-llvm -o %t %s
 
 // clang 1.0 fails to compile Python 2.6
-// RUN: %clang -target x86_64-apple-darwin9 -### -S %s -mmacosx-version-min=10.4
+// RUN: %clang -target x86_64-apple-darwin9 -### -S %s -mmacos-version-min=10.4
diff --git a/clang/test/Driver/arc.c b/clang/test/Driver/arc.c
index 6c91a3b1c87c6..e5d1af5225662 100644
--- a/clang/test/Driver/arc.c
+++ b/clang/test/Driver/arc.c
@@ -3,7 +3,7 @@
 // RUN: not %clang -x objective-c++ -target i386-apple-darwin10 -stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
 // RUN: not %clang -x c -target i386-apple-darwin10 -stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
 // RUN: not %clang -x c++ -target i386-apple-darwin10 -stdlib=libstdc++ -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
-// RUN: not %clang -x objective-c -target x86_64-apple-darwin11 -mmacosx-version-min=10.5 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTSUPPORTED %s
+// RUN: not %clang -x objective-c -target x86_64-apple-darwin11 -mmacos-version-min=10.5 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTSUPPORTED %s
 
 // Just to test clang is working.
 # foo
diff --git a/clang/test/Driver/arclite-link.c b/clang/test/Driver/arclite-link.c
index 9c01267ef972d..9e8eea768818e 100644
--- a/clang/test/Driver/arclite-link.c
+++ b/clang/test/Driver/arclite-link.c
@@ -1,9 +1,9 @@
 // RUN: touch %t.o
 // RUN: mkdir -p %t.tmpdir/Xcode.app/Contents/Developers/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
-// RUN: not %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.10 %t.o \
+// RUN: not %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacos-version-min=10.10 %t.o \
 // RUN: -isysroot %t.tmpdir/Xcode.app/Contents/Developers/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
-// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.11 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
-// RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacos-version-min=10.11 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
+// RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacos-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
 // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -nostdlib %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOSTDLIB %s
 
 // CHECK-ARCLITE-OSX: .tmpdir/Xcode.app/{{.*}}libarclite_macosx.a';
@@ -16,7 +16,7 @@
 // CHECK-NOARCLITE-NOT: libarclite
 // CHECK-NOSTDLIB-NOT: -lobjc
 
-// RUN: not %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -fobjc-arc -mmacosx-version-min=10.10 %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED %s
+// RUN: not %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -fobjc-arc -mmacos-version-min=10.10 %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED %s
 
 // CHECK-UNUSED-NOT: warning: argument unused during compilation: '-fobjc-link-runtime'
 
diff --git a/clang/test/Driver/darwin-objc-defaults.m b/clang/test/Driver/darwin-objc-defaults.m
index bbcb7e0c6690d..0e06cf7151794 100644
--- a/clang/test/Driver/darwin-objc-defaults.m
+++ b/clang/test/Driver/darwin-objc-defaults.m
@@ -3,7 +3,7 @@
 // i386
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
-// RUN:   -arch i386 -mmacosx-version-min=10.5 2> %t
+// RUN:   -arch i386 -mmacos-version-min=10.5 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-I386_OSX10_5 < %t %s
 
 // CHECK-CHECK-I386_OSX10_5: "-cc1"
@@ -12,7 +12,7 @@
 // CHECK-CHECK-I386_OSX10_5: darwin-objc-defaults
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
-// RUN:   -arch i386 -mmacosx-version-min=10.6 2> %t
+// RUN:   -arch i386 -mmacos-version-min=10.6 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-I386_OSX10_6 < %t %s
 
 // CHECK-CHECK-I386_OSX10_6: "-cc1"
@@ -32,14 +32,14 @@
 // x86_64
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
-// RUN:   -arch x86_64 -mmacosx-version-min=10.4 2> %t
+// RUN:   -arch x86_64 -mmacos-version-min=10.4 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-X86_64_OSX10_4 < %t %s
 
 // CHECK-CHECK-X86_64_OSX10_4: "-cc1"
 // CHECK-CHECK-X86_64_OSX10_4: -fobjc-dispatch-method=non-legacy
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
-// RUN:   -arch x86_64 -mmacosx-version-min=10.5 2> %t
+// RUN:   -arch x86_64 -mmacos-version-min=10.5 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-X86_64_OSX10_5 < %t %s
 
 
@@ -49,7 +49,7 @@
 // CHECK-CHECK-X86_64_OSX10_5: darwin-objc-defaults
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
-// RUN:   -arch x86_64 -mmacosx-version-min=10.6 2> %t
+// RUN:   -arch x86_64 -mmacos-version-min=10.6 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-X86_64_OSX10_6 < %t %s
 
 // CHECK-CHECK-X86_64_OSX10_6: "-cc1"
@@ -67,7 +67,7 @@
 // armv7
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
-// RUN:   -arch armv7 -mmacosx-version-min=10.5 2> %t
+// RUN:   -arch armv7 -mmacos-version-min=10.5 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-ARMV7_OSX10_5 < %t %s
 
 // CHECK-CHECK-ARMV7_OSX10_5: "-cc1"
@@ -76,7 +76,7 @@
 // CHECK-CHECK-ARMV7_OSX10_5: darwin-objc-defaults
 
 // RUN: %clang -target x86_64-apple-darwin10 -S -### %s	\
-// RUN:   -arch armv7 -mmacosx-version-min=10.6 2> %t
+// RUN:   -arch armv7 -mmacos-version-min=10.6 2> %t
 // RUN: FileCheck --check-prefix CHECK-CHECK-ARMV7_OSX10_6 < %t %s
 
 // CHECK-CHECK-ARMV7_OSX10_6: "-cc1"
diff --git a/clang/test/Driver/darwin-stdlib-dont-pass-in-c.c b/clang/test/Driver/darwin-stdlib-dont-pass-in-c.c
index 3213223ff763e..59ab93fed7202 100644
--- a/clang/test/Driver/darwin-stdlib-dont-pass-in-c.c
+++ b/clang/test/Driver/darwin-stdlib-dont-pass-in-c.c
@@ -1,7 +1,7 @@
 // This test ensures that the Driver doesn't pass -stdlib= down to CC1 when compiling C code.
 
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacos-version-min=10.9 %s -### 2>&1 | FileCheck %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k %s -### 2>&1 | FileCheck %s
 
diff --git a/clang/test/Driver/darwin-stdlib.cpp b/clang/test/Driver/darwin-stdlib.cpp
index 500a5d534f213..0113c5fc029e3 100644
--- a/clang/test/Driver/darwin-stdlib.cpp
+++ b/clang/test/Driver/darwin-stdlib.cpp
@@ -1,7 +1,7 @@
 // Make sure that the Driver passes down -stdlib=libc++ to CC1 when specified explicitly.
 //
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64  -miphoneos-version-min=7.0 -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBCXX %s
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/              -mmacosx-version-min=10.9  -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBCXX %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/              -mmacos-version-min=10.9  -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBCXX %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBCXX %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k                            -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBCXX %s
 // CHECK-LIBCXX: "-stdlib=libc++"
@@ -12,7 +12,7 @@
 // Driver behavior for now.
 //
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64  -miphoneos-version-min=7.0 -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBSTDCXX %s
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/              -mmacosx-version-min=10.9  -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBSTDCXX %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/              -mmacos-version-min=10.9  -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBSTDCXX %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBSTDCXX %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k                            -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefix=CHECK-LIBSTDCXX %s
 // CHECK-LIBSTDCXX: "-stdlib=libstdc++"
@@ -23,7 +23,7 @@
 // going to be libc++.
 //
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64  -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/              -mmacosx-version-min=10.9  %s -### 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/              -mmacos-version-min=10.9  %s -### 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
 // RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k                            %s -### 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
 // CHECK-NONE-NOT: "-stdlib="
diff --git a/clang/test/Driver/darwin-version.c b/clang/test/Driver/darwin-version.c
index 96f7ba07c94e9..ff05d4c10c487 100644
--- a/clang/test/Driver/darwin-version.c
+++ b/clang/test/Driver/darwin-version.c
@@ -62,27 +62,27 @@
 
 // RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX4 %s
-// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \
+// RUN: %clang -target i686-apple-darwin9 -mmacos-version-min=10.4 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX4 %s
 // CHECK-VERSION-OSX4: "i686-apple-macosx10.4.0"
 // RUN: %clang -target i686-apple-darwin9 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX5 %s
-// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.5 -c %s -### 2>&1 | \
+// RUN: %clang -target i686-apple-darwin9 -mmacos-version-min=10.5 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX5 %s
 // CHECK-VERSION-OSX5: "i686-apple-macosx10.5.0"
 // RUN: %clang -target i686-apple-darwin10 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX6 %s
-// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.6 -c %s -### 2>&1 | \
+// RUN: %clang -target i686-apple-darwin9 -mmacos-version-min=10.6 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX6 %s
 // CHECK-VERSION-OSX6: "i686-apple-macosx10.6.0"
 // RUN: %clang -target x86_64-apple-darwin14 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX10 %s
-// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.10 -c %s -### 2>&1 | \
+// RUN: %clang -target x86_64-apple-darwin -mmacos-version-min=10.10 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX10 %s
 // RUN: %clang -target x86_64-apple-darwin -mmacos-version-min=10.10 -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-OSX10 %s
 // CHECK-VERSION-OSX10: "x86_64-apple-macosx10.10.0"
-// RUN: not %clang -target x86_64-apple-darwin -mmacosx-version-min= -c %s -### 2>&1 | \
+// RUN: not %clang -target x86_64-apple-darwin -mmacos-version-min= -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-MISSING %s
 // RUN: not %clang -target x86_64-apple-darwin -mmacos-version-min= -c %s -### 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-VERSION-MISSING %s
diff --git a/clang/test/Driver/darwin-xarch.c b/clang/test/Driver/darwin-xarch.c
index 2b9682a253d73..521ff9e1f6180 100644
--- a/clang/test/Driver/darwin-xarch.c
+++ b/clang/test/Driver/darwin-xarch.c
@@ -1,6 +1,6 @@
 // RUN: %clang --target=x86_64-apple-darwin10 -### \
-// RUN:   -arch i386 -Xarch_i386 -mmacosx-version-min=10.4 \
-// RUN:   -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 \
+// RUN:   -arch i386 -Xarch_i386 -mmacos-version-min=10.4 \
+// RUN:   -arch x86_64 -Xarch_x86_64 -mmacos-version-min=10.5 \
 // RUN:   -c %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-COMPILE < %t %s
 //
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
index ba64b3dcb11aa..08e9c78f9d1d2 100644
--- a/clang/test/Driver/fsanitize.c
+++ b/clang/test/Driver/fsanitize.c
@@ -545,7 +545,7 @@
 // RUN: %clang --target=riscv64-pc-freebsd -fsanitize=function %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FUNCTION
 // CHECK-FUNCTION: -cc1{{.*}}"-fsanitize=function" "-fsanitize-recover=function"
 
-// RUN: not %clang --target=x86_64-apple-darwin10 -mmacosx-version-min=10.8 -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-OLD
+// RUN: not %clang --target=x86_64-apple-darwin10 -mmacos-version-min=10.8 -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-OLD
 // CHECK-VPTR-DARWIN-OLD: unsupported option '-fsanitize=vptr' for target 'x86_64-apple-darwin10'
 
 // RUN: not %clang --target=arm-apple-ios4 -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-IOS-OLD
@@ -557,7 +557,7 @@
 // RUN: %clang --target=x86_64-apple-darwin15.0.0-simulator -fsanitize=vptr %s -### 2>&1
 // OK
 
-// RUN: %clang --target=x86_64-apple-darwin10 -mmacosx-version-min=10.9 -fsanitize=alignment,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-NEW
+// RUN: %clang --target=x86_64-apple-darwin10 -mmacos-version-min=10.9 -fsanitize=alignment,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-NEW
 // CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr
 
 // RUN: %clang --target=armv7-apple-ios7 -miphoneos-version-min=7.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS
@@ -643,7 +643,7 @@
 // RUN: not %clang --target=x86_64-linux-gnu -fsanitize-trap=hwaddress -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HWASAN-TRAP
 // CHECK-HWASAN-TRAP: error: unsupported argument 'hwaddress' to option '-fsanitize-trap='
 
-// RUN: not %clang --target=x86_64-apple-darwin10 -mmacosx-version-min=10.7 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-OLD-MACOS
+// RUN: not %clang --target=x86_64-apple-darwin10 -mmacos-version-min=10.7 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-OLD-MACOS
 // CHECK-CFI-NOTRAP-OLD-MACOS: error: unsupported option '-fno-sanitize-trap=cfi-vcall' for target 'x86_64-apple-darwin10'
 
 // RUN: %clang --target=x86_64-pc-win32 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-WIN
diff --git a/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp b/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
index f622016e2b169..9f96188e25280 100644
--- a/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
+++ b/clang/test/Driver/macos-apple-silicon-slice-link-libs-darwin-only.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang -### -target arm64-apple-darwin -arch arm64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
-// RUN: %clang -### -target x86_64-apple-darwin10 -arch x86_64 -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
+// RUN: %clang -### -target arm64-apple-darwin -arch arm64 -mmacos-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=ARM64-10_7 %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -arch x86_64 -mmacos-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=x86_64-10_7 %s
 // REQUIRES: system-darwin
 
 // ARM64-10_7-NOT: -lcrt1.10.6.o
diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c
index 7289d09697b4d..1dc8b446d7b6d 100644
--- a/clang/test/Driver/sanitizer-ld.c
+++ b/clang/test/Driver/sanitizer-ld.c
@@ -688,7 +688,7 @@
 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "--export-dynamic-symbol=__cfi_check"
 
 // RUN: %clangxx -fsanitize=address -### %s 2>&1 \
-// RUN:     -mmacosx-version-min=10.6 \
+// RUN:     -mmacos-version-min=10.6 \
 // RUN:     --target=x86_64-app...
[truncated]

@Xazax-hun Xazax-hun requested a review from ahatanak June 13, 2024 09:54
Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fanquake added a commit to fanquake/bitcoin that referenced this pull request Jun 13, 2024
Whilst these remain aliases for each other, the later is preferred,
and I assume the former will be removed at some point in the future;
see: llvm/llvm-project#95374.
@@ -389,6 +389,7 @@ my %CompilerLinkerOptionMap = (
'-target' => 1,
'-v' => 0,
'-mmacosx-version-min' => 0, # This is really a 1 argument, but always has '='
'-mmacos-version-min' => 0, # This is really a 1 argument, but always has '='
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice nice nice thanks!

fanquake added a commit to fanquake/bitcoin that referenced this pull request Jun 14, 2024
Whilst these remain aliases for each other, the later is preferred,
and I assume the former will be removed at some point in the future;
see: llvm/llvm-project#95374.
The -mmacos-version-min flag is preferred over -mmacosx-version-min. This patch
makes updates the tests and documentation to make this clear and also adds the
missing logic to scan build to handle the new flag.

Fixes llvm#86376.
@Xazax-hun Xazax-hun force-pushed the macos-version-cleanup branch from bbb0e31 to ad99b7f Compare June 16, 2024 09:36
@Xazax-hun Xazax-hun merged commit edabb5c into llvm:main Jun 16, 2024
8 checks passed
fanquake added a commit to bitcoin/bitcoin that referenced this pull request Jun 18, 2024
…or `mmacos-version-min`

7c298fe doc: rewrite some of the macdeploy docs (fanquake)
d042230 depends: swap mmacosx-version-min for mmacos-version-min (fanquake)

Pull request description:

  Whilst `-mmacosx-version-min` and `-mmacos-version-min` remain aliases for each other, the later is preferred,
  and I assume the former will be removed at some point in the future; see: llvm/llvm-project#95374.

  Somewhat of a followup to #21778. Rewrite some of the mac deploy docs.

ACKs for top commit:
  theuni:
    utACK 7c298fe
  TheCharlatan:
    ACK 7c298fe
  hebasto:
    ACK 7c298fe.

Tree-SHA512: 6493f087fde93e0eec319af0e105d163b3f047d8a03f7d4b0d6cd7c64b58d0a978b7d67c6b8dba5c6ccf8b10e188aab5dc98eec400b0546dc9ee801a689b4332
janus pushed a commit to BitgesellOfficial/bitgesell that referenced this pull request Jul 26, 2024
Whilst these remain aliases for each other, the later is preferred,
and I assume the former will be removed at some point in the future;
see: llvm/llvm-project#95374.
@Xazax-hun Xazax-hun deleted the macos-version-cleanup branch August 15, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:static analyzer clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency in macos/macosx version CLI flag vs. availability attributes/macros
4 participants