-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Inconsistency in macos/macosx version CLI flag vs. availability attributes/macros #86376
Comments
@llvm/issue-subscribers-clang-driver Author: None (h-vetinari)
The clang attribute [reference](https://clang.llvm.org/docs/AttributeReference.html#availability) says:
> * `macos`:
> Apple’s macOS operating system. The minimum deployment target is specified by the `-mmacosx-version-min=*version*` command-line argument. `macosx` is supported for backward-compatibility reasons, but it is deprecated.
So we learn that the attribute should be spelled with
however, the CLI-flag as documented still uses the "x":
At the very least, this leads to confusion, as both forms are found in the current LLVM repo:
I also believe it may lead to bugs, in the sense that I don't have a mac to test this hypothesis, but this is consistent with the failures I'm seeing. |
CC @ldionne |
The driver currently accepts both
I tested them with the following small program and both seem to work as expected:
Is there any action item in this ticket? E.g., do we want to make one of the flags deprecated, potentially emitting a warning to migrate to another one? I am not sure how often are we doing that in Clang. |
Thanks for the response! From my POV, the default CLI flag should match the naming in the availability macros, i.e. use |
^ I agree. Basically, the action item in this ticket would be to make sure that the default flag is |
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.
I opened a PR to update the documentation and tests. I also realized scan-build did not properly handle the new spelling, so I also updated that. |
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.
The clang attribute reference says:
So we learn that the attribute should be spelled with
macos
, notmacosx
:however, the CLI-flag as documented still uses the "x":
At the very least, this leads to confusion, as both forms are found in the current LLVM repo:
-mmacosx-version-min
-mmacos-version-min
I also believe it may lead to bugs, in the sense that
-mmacosx-version-min=10.9
in newer clang ends up not settingMAC_OS_X_VERSION_MIN_REQUIRED
or__MAC_OS_X_VERSION_MIN_REQUIRED
?I don't have a mac to test this hypothesis, but this is consistent with the failures I'm seeing.
The text was updated successfully, but these errors were encountered: