commit 9b0d3d17b04a59bb591c06273d2d5a975f8c5d58
Author: Lawrence Velázquez <vq@larryv.me>
Date: Fri Nov 14 17:52:32 2014 -0500
Handle OS X deployment targets correctly
As described in PR target/63810, this addresses several problems with
the validation and encoding of deployment target version strings for the
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro. There are
currently four testcases exercising inputs to -mmacosx-version-min
(gcc/testsuite/gcc.dg/darwin-minversion-*), but they provide minimal
coverage, and one is incorrect.
* The tiny number is now respected, if present. Thus "10.9.4"
correctly becomes "1094" instead of "1090", and "10.10.1" becomes
"101001" instead of "101000".
* Zero padding is now ignored. Thus "10.09" correctly becomes "1090"
instead of "100900", and "10.00010" becomes "101000" instead of being
* Deployment targets that are missing minor and tiny numbers are no
longer considered invalid. Thus "10" is treated as "10.0.0", which
becomes "1000" without causing an error.
With this change, trunk matches the behavior of Apple LLVM Compiler
6.1.0 on 8,451 of 8,464 generated test inputs. (The discrepancies are
due to a bug in Clang.) I don't notice any testsuite regressions on
OS X 10.10 Yosemite x86-64.
2015-05-15 Lawrence Velázquez <vq@larryv.me>
* gcc/config/darwin-c.c (version_components): New global enum.
(parse_version, version_as_legacy_macro)
(version_as_modern_macro, macosx_version_as_macro): New functions.
(version_as_macro): Remove.
(darwin_cpp_builtins): Use new function.
* gcc/testsuite/gcc.dg/darwin-minversion-3.c: Update testcase.
* gcc/testsuite/gcc.dg/darwin-minversion-4.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-5.c: New testcase.
* gcc/testsuite/gcc.dg/darwin-minversion-6.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-7.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-8.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-9.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-10.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-11.c: Ditto.
* gcc/testsuite/gcc.dg/darwin-minversion-12.c: Ditto.
Adapted for LLVM-GCC 4.2.1 (2336.11) from my upstream trunk fix.
Extended to fix handling of iOS deployment targets.
I hereby relicense my upstream contributions under GPLv2 when used by
the MacPorts Project, as permitted by the terms of the FSF copyright
The text above is from my email to the gcc-patches mailing list; some
minor details may not apply to the patch below.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01888.html
https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=rev&rev=223808
Index: gcc/config/darwin-c.c
===================================================================