This is an archive of the discontinued LLVM Phabricator instance.

[darwin][driver] Warn about mismatching -<os>-version-min rather than superfluous -<os>-version-min compiler option
ClosedPublic

Authored by arphaman on Dec 19 2017, 5:40 PM.

Details

Summary

The warning about the superfluous -<os>-version-min compiler option seems a little too strong right now. For now we should only warn about -<os>-version-min options that specify a different OS version to the -target's version.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Dec 19 2017, 5:40 PM
bob.wilson accepted this revision.Dec 19 2017, 6:06 PM

Eventually it would be nice to also warn about redundant -m*-version-min options, but for now I agree that it would be best to start with warning only when the options are different.

This revision is now accepted and ready to land.Dec 19 2017, 6:06 PM
steven_wu accepted this revision.Dec 19 2017, 6:07 PM

Just a small suggestion. Looks good otherwise.

lib/Driver/ToolChains/Darwin.cpp
1536 ↗(On Diff #127637)

HadExtra is not ok right? macos10.11.0.1 is not the same as macos10.11.0?
Or HadExtra is an error somewhere else already?

arphaman added inline comments.Dec 19 2017, 6:10 PM
lib/Driver/ToolChains/Darwin.cpp
1536 ↗(On Diff #127637)

Right, it would be nice to check the extra stuff too. I will commit with the check and a test for the extra part.

steven_wu added inline comments.Dec 19 2017, 6:13 PM
lib/Driver/ToolChains/Darwin.cpp
1536 ↗(On Diff #127637)

And what about "-target x86_64-apple-macos -mmacos-version-min=10.6"?

arphaman added inline comments.Dec 19 2017, 6:30 PM
lib/Driver/ToolChains/Darwin.cpp
1536 ↗(On Diff #127637)

We will warn on that.

This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
1545

warn_drv_overriding_flag_option is in the group -Woverriding-t-option (D1290), which is for clang-cl /T* options.
I think we need a different diagnostic group for this purpose. I created D158137 to add warn_drv_overriding_option.

Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2023, 7:20 PM
Herald added a subscriber: ributzka. · View Herald Transcript