[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #35 from Iain Sandoe --- Author: iains Date: Wed Sep 4 19:17:41 2019 New Revision: 275382 URL: https://gcc.gnu.org/viewcvs?rev=275382=gcc=rev Log: [Darwin, Driver] Fix driver crashes with valid command line input. Backport Improve processing of macosx-version-min= For PR target/63810 some improvements were made in the parsing of the version string at the point it's used to define the built-in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the specs processing also uses the version, and specs version-compare doesn't like leading zeros on components. This means that while we succeed in processing -mmacosx-version-min=010.2.99 on compile lines, it fails for any other line that uses the value as part of a spec (in particular, link lines fail). To fix this, we need to apply a bit of clean-up to the version that's presented to the driver, and push that back into the command line opts. The value can come from four places: 1. User-entered on the command line 2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var. 3. Absent those two 3a For self-hosting systems, look-up from the kernel 3b For cross-compilers, as a default supplied at configure time. We apply the clean-up to all 4 (although it shouldn't really be needed for the cases under 3). We also supply a test-case that adapts to the target-version of the system, so that the link requirements are met by the SDK in use (if you try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail). gcc/ 2019-09-04 Iain Sandoe Backport from mainline 2019-06-19 Iain Sandoe * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors in computing the number of options to be moved. Backport from mainline 2019-06-13 Iain Sandoe * config/darwin-driver.c (validate_macosx_version_min): New. (darwin_default_min_version): Cleanup and validate supplied version. (darwin_driver_init): Likewise and push cleaned version into opts. gcc/testsuite/ 2019-09-04 Iain Sandoe Backport from mainline. 2019-06-13 Iain Sandoe * gcc.dg/darwin-minversion-link.c: New test. Added: branches/gcc-7-branch/gcc/testsuite/gcc.dg/darwin-minversion-link.c Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/config/darwin-driver.c branches/gcc-7-branch/gcc/testsuite/ChangeLog
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #34 from Iain Sandoe --- Author: iains Date: Sun Aug 25 19:27:04 2019 New Revision: 274912 URL: https://gcc.gnu.org/viewcvs?rev=274912=gcc=rev Log: [Darwin, Driver] Fix driver crashes with valid command line input. Backport Improve processing of macosx-version-min= For PR target/63810 some improvements were made in the parsing of the version string at the point it's used to define the built-in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the specs processing also uses the version, and specs version-compare doesn't like leading zeros on components. This means that while we succeed in processing -mmacosx-version-min=010.2.99 on compile lines, it fails for any other line that uses the value as part of a spec (in particular, link lines fail). To fix this, we need to apply a bit of clean-up to the version that's presented to the driver, and push that back into the command line opts. The value can come from four places: 1. User-entered on the command line 2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var. 3. Absent those two 3a For self-hosting systems, look-up from the kernel 3b For cross-compilers, as a default supplied at configure time. We apply the clean-up to all 4 (although it shouldn't really be needed for the cases under 3). We also supply a test-case that adapts to the target-version of the system, so that the link requirements are met by the SDK in use (if you try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail). gcc/ 2019-08-25 Iain Sandoe Backport from mainline 2019-06-19 Iain Sandoe * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors in computing the number of options to be moved. Backport from mainline 2019-06-13 Iain Sandoe * config/darwin-driver.c (validate_macosx_version_min): New. (darwin_default_min_version): Cleanup and validate supplied version. (darwin_driver_init): Likewise and push cleaned version into opts. gcc/testsuite/ 2019-08-25 Iain Sandoe 2019-06-13 Iain Sandoe * gcc.dg/darwin-minversion-link.c: New test. Added: branches/gcc-8-branch/gcc/testsuite/gcc.dg/darwin-minversion-link.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/config/darwin-driver.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #33 from Iain Sandoe --- Author: iains Date: Fri Aug 2 14:54:57 2019 New Revision: 274017 URL: https://gcc.gnu.org/viewcvs?rev=274017=gcc=rev Log: darwin, backport driver fixes. 272260,r272479 - Darwin, Driver - Improve processing of macosx-version-min= For PR target/63810 some improvements were made in the parsing of the version string at the point it's used to define the built-in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the specs processing also uses the version, and specs version-compare doesn't like leading zeros on components. This means that while we succeed in processing -mmacosx-version-min=010.2.99 on compile lines, it fails for any other line that uses the value as part of a spec (in particular, link lines fail). To fix this, we need to apply a bit of clean-up to the version that's presented to the driver, and push that back into the command line opts. The value can come from four places: 1. User-entered on the command line 2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var. 3. Absent those two 3a For self-hosting systems, look-up from the kernel 3b For cross-compilers, as a default supplied at configure time. We apply the clean-up to all 4 (although it shouldn't really be needed for the cases under 3). We also supply a test-case that adapts to the target-version of the system, so that the link requirements are met by the SDK in use (if you try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail). gcc/ 2019-08-02 Iain Sandoe Backport from mainline 2019-06-19 Iain Sandoe * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors in computing the number of options to be moved. Backport from mainline 2019-06-13 Iain Sandoe * config/darwin-driver.c (validate_macosx_version_min): New. (darwin_default_min_version): Cleanup and validate supplied version. (darwin_driver_init): Likewise and push cleaned version into opts. gcc/testsuite/ 2019-08-02 Iain Sandoe 2019-06-13 Iain Sandoe * gcc.dg/darwin-minversion-link.c: New test. Added: branches/gcc-9-branch/gcc/testsuite/gcc.dg/darwin-minversion-link.c Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/config/darwin-driver.c branches/gcc-9-branch/gcc/testsuite/ChangeLog
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #32 from Iain Sandoe --- Author: iains Date: Thu Jun 13 18:53:05 2019 New Revision: 272260 URL: https://gcc.gnu.org/viewcvs?rev=272260=gcc=rev Log: Darwin, Driver - Improve processing of macosx-version-min= For PR target/63810 some improvements were made in the parsing of the version string at the point it's used to define the built-in __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. This is fine, but the specs processing also uses the version, and specs version-compare doesn't like leading zeros on components. This means that while we succeed in processing -mmacosx-version-min=010.2.99 on compile lines, it fails for any other line that uses the value as part of a spec (in particular, link lines fail). To fix this, we need to apply a bit of clean-up to the version that's presented to the driver, and push that back into the command line opts. The value can come from four places: 1. User-entered on the command line 2. User-entered as MACOSX_DEPLOYMENT_TARGET= environment var. 3. Absent those two 3a For self-hosting systems, look-up from the kernel 3b For cross-compilers, as a default supplied at configure time. We apply the clean-up to all 4 (although it shouldn't really be needed for the cases under 3). We also supply a test-case that adapts to the target-version of the system, so that the link requirements are met by the SDK in use (if you try to link i686-darwin9 on an x86-64-darwin18 SDK, it will fail). gcc/ 2019-06-13 Iain Sandoe * config/darwin-driver.c (validate_macosx_version_min): New. (darwin_default_min_version): Cleanup and validate supplied version. (darwin_driver_init): Likewise and push cleaned version into opts. gcc/testsuite/ 2019-06-13 Iain Sandoe * gcc.dg/darwin-minversion-link.c: New test. Added: trunk/gcc/testsuite/gcc.dg/darwin-minversion-link.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/darwin-driver.c trunk/gcc/testsuite/ChangeLog
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #26 from mrs at gcc dot gnu.org mrs at gcc dot gnu.org --- Author: mrs Date: Thu May 28 12:27:05 2015 New Revision: 223808 URL: https://gcc.gnu.org/viewcvs?rev=223808root=gccview=rev Log: 2015-05-28 Lawrence Velázquez v...@larryv.me PR target/63810 * 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. testsuite: PR target/63810 * gcc.dg/darwin-minversion-3.c: Update testcase. * gcc.dg/darwin-minversion-4.c: Ditto. * gcc.dg/darwin-minversion-5.c: New testcase. * gcc.dg/darwin-minversion-6.c: Ditto. * gcc.dg/darwin-minversion-7.c: Ditto. * gcc.dg/darwin-minversion-8.c: Ditto. * gcc.dg/darwin-minversion-9.c: Ditto. * gcc.dg/darwin-minversion-10.c: Ditto. * gcc.dg/darwin-minversion-11.c: Ditto. * gcc.dg/darwin-minversion-12.c: Ditto. Added: trunk/gcc/testsuite/gcc.dg/darwin-minversion-10.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-11.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-12.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-5.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-6.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-7.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-8.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-9.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/darwin-c.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/darwin-minversion-3.c trunk/gcc/testsuite/gcc.dg/darwin-minversion-4.c
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 mrs at gcc dot gnu.org mrs at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Known to work||6.0 Resolution|--- |FIXED --- Comment #27 from mrs at gcc dot gnu.org mrs at gcc dot gnu.org --- Fixed in 6.0. Backports pre approved after bake time and testing that includes older darwins and ppc.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez vq at larryv dot me changed: What|Removed |Added Attachment #34010|0 |1 is obsolete|| --- Comment #28 from Lawrence Velázquez vq at larryv dot me --- Created attachment 35645 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35645action=edit backport to gcc-5-branch
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez vq at larryv dot me changed: What|Removed |Added Attachment #34012|0 |1 is obsolete|| --- Comment #30 from Lawrence Velázquez vq at larryv dot me --- Created attachment 35647 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35647action=edit backport to gcc-4_8-branch
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez vq at larryv dot me changed: What|Removed |Added Attachment #34011|0 |1 is obsolete|| --- Comment #29 from Lawrence Velázquez vq at larryv dot me --- Created attachment 35646 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35646action=edit backport to gcc-4_9-branch
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #31 from Lawrence Velázquez vq at larryv dot me --- (In reply to m...@gcc.gnu.org from comment #27) Fixed in 6.0. Backports pre approved after bake time and testing that includes older darwins and ppc. Thanks! I've attached updated patches against 4.8, 4.9, and 5.1, if you need them.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #25 from Lawrence Velázquez vq at larryv dot me --- (In reply to m...@gcc.gnu.org from comment #22) Though I approved it on list, you should feel free to update with the review points others have and post that version if you wish. Re-roll posted: https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01888.html
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #24 from Francois-Xavier Coudert fxcoudert at gcc dot gnu.org --- (In reply to Lawrence Velázquez from comment #23) I don't see anything in version_as_legacy_macro() that specifically deals with major = 9. Could you point me to the offending code? In the comment above it (Major numbers are zero-padded if necessary), and the sprintf format %02lu%lu%lu (which can be %lu%lu%lu).
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #20 from Lawrence Velázquez vq at larryv dot me --- (In reply to Francois-Xavier Coudert from comment #18) (In reply to Lawrence Velázquez from comment #17) Hey Lawrence, do you have a copyright assignment in place with the FSF? If so, please submit your trunk patch to gcc-patc...@gcc.gnu.org for review. If not, ask on the g...@gcc.gnu.org list for the paperwork to be sent to you. Sorry, it took me a while to obtain the paperwork, and even longer to get around to submitting it. https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01377.html
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #21 from Francois-Xavier Coudert fxcoudert at gcc dot gnu.org --- (In reply to Lawrence Velázquez from comment #20) https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01377.html Quick review of the patch: - version_as_modern_macro(): you implement a specific behavior for major = 9, but it's necessary at all. Having major = 9 is simply impossible (and Apple's compiler rejects it). I'd say let's make things simpler anduse a format of %02lu%02lu%02lu and always be 6 characters long. - version_as_legacy_macro(): same issue. Why do we need to handle major = 9? You have rejected this possibility in macosx_version_as_macro() anyway. Simplify here also. - throughout the patch, writing things like (int) sizeof - 1 or char result[sizeof ] when you could write 4 and char result[4] means harder code to read, and no real benefit in terms of security or maintainability (since you're duplicating stuff anyway). - in macosx_version_as_macro(), you say Allow for future major numbers greater than 10, but you actually reject them (and that's OK). Adjust the comment. - later, version_array[MAJOR] == 10 is guaranteed. Remove it. - in parse_version(), the string passed is guaranteed to be non-NULL. No need to test it.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 mrs at gcc dot gnu.org mrs at gcc dot gnu.org changed: What|Removed |Added CC||mrs at gcc dot gnu.org Known to fail||5.1.0 --- Comment #22 from mrs at gcc dot gnu.org mrs at gcc dot gnu.org --- Though I approved it on list, you should feel free to update with the review points others have and post that version if you wish.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #23 from Lawrence Velázquez vq at larryv dot me --- (In reply to Francois-Xavier Coudert from comment #21) - version_as_legacy_macro(): same issue. Why do we need to handle major = 9? You have rejected this possibility in macosx_version_as_macro() anyway. Simplify here also. I don't see anything in version_as_legacy_macro() that specifically deals with major = 9. Could you point me to the offending code?
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Eric Gallager egall at gwmail dot gwu.edu changed: What|Removed |Added CC||egall at gwmail dot gwu.edu --- Comment #19 from Eric Gallager egall at gwmail dot gwu.edu --- (In reply to Francois-Xavier Coudert from comment #18) (In reply to Lawrence Velázquez from comment #17) Hey Lawrence, do you have a copyright assignment in place with the FSF? If so, please submit your trunk patch to gcc-patc...@gcc.gnu.org for review. If not, ask on the g...@gcc.gnu.org list for the paperwork to be sent to you. He appears to still be waiting on a response to a ping as of http://gcc.gnu.org/ml/gcc/2014-12/msg00047.html
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #18 from Francois-Xavier Coudert fxcoudert at gcc dot gnu.org --- (In reply to Lawrence Velázquez from comment #17) Hey Lawrence, do you have a copyright assignment in place with the FSF? If so, please submit your trunk patch to gcc-patc...@gcc.gnu.org for review. If not, ask on the g...@gcc.gnu.org list for the paperwork to be sent to you.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33975|0 |1 is obsolete|| --- Comment #12 from Lawrence Velázquez larryv at macports dot org --- Created attachment 34007 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34007action=edit patch against trunk to handle deployment targets correctly Added some missing null checks; minor comment editing.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33977|0 |1 is obsolete|| --- Comment #14 from Lawrence Velázquez larryv at macports dot org --- Created attachment 34009 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34009action=edit patch against 4.8 branch to handle deployment targets correctly Added some missing null checks; minor comment editing.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33976|0 |1 is obsolete|| --- Comment #13 from Lawrence Velázquez larryv at macports dot org --- Created attachment 34008 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34008action=edit patch against 4.9 branch to handle deployment targets correctly Added some missing null checks; minor comment editing.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #34007|0 |1 is obsolete|| --- Comment #15 from Lawrence Velázquez larryv at macports dot org --- Created attachment 34010 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34010action=edit patch against trunk to handle deployment targets correctly Forgot to fix a comment in the last update.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #34008|0 |1 is obsolete|| --- Comment #16 from Lawrence Velázquez larryv at macports dot org --- Created attachment 34011 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34011action=edit patch against 4.9 branch to handle deployment targets correctly Forgot to fix a comment in the last update.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #34009|0 |1 is obsolete|| --- Comment #17 from Lawrence Velázquez larryv at macports dot org --- Created attachment 34012 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34012action=edit patch against 4.8 branch to handle deployment targets correctly Forgot to fix a comment in the last update.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #3 from Lawrence Velázquez larryv at macports dot org --- Created attachment 33968 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33968action=edit patch against trunk for handling deployment targets correctly This is more of a rewrite than just a patch. I've divorced parsing of the version string from assembly of legacy macro values from assembly of modern macro values. It should hopefully be easier to make adjustments in the future, since this code is more than a crude DFA implementation.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #4 from Lawrence Velázquez larryv at macports dot org --- Created attachment 33969 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33969action=edit patch against 4.9 branch for handling deployment targets correctly Patched GCC 4.9.2 matched the behavior of Apple LLVM Compiler 6.0 (clang-600.0.54) over 8,451 out of 8,464 test strings. The 13 mismatches are due to a bug in clang.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #5 from Lawrence Velázquez larryv at macports dot org --- Created attachment 33970 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33970action=edit patch against 4.8 branch for handling deployment targets correctly This patch incorporates and supersedes attachment 33932 from bug 61407.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #6 from howarth at bromo dot med.uc.edu --- The proposed patch for gcc trunk fails to build here against r217590 /sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/./prev-gcc/xg++ -B/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/./prev-gcc/ -B/sw/lib/gcc5.0/x86_64-apple-darwin14.0.0/bin/ -nostdinc++ -B/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs -B/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs -I/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/include/x86_64-apple-darwin14.0.0 -I/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/include -I/sw/src/fink.build/gcc50-5.0.0-1000/gcc-5-20141114/libstdc++-v3/libsupc++ -L/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/src/.libs -L/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/prev-x86_64-apple-darwin14.0.0/libstdc++-v3/libsupc++/.libs -c -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -gtoggle -DIN_GCC-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc-5-20141114/gcc -I../../gcc-5-20141114/gcc/. -I../../gcc-5-20141114/gcc/../include -I../../gcc-5-20141114/gcc/../libcpp/include -I/sw/include -I/sw/include -I../../gcc-5-20141114/gcc/../libdecnumber -I../../gcc-5-20141114/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-5-20141114/gcc/../libbacktrace -DCLOOG_INT_GMP -I/sw/include -I/sw/include -o darwin-c.o -MT darwin-c.o -MMD -MP -MF ./.deps/darwin-c.TPo -DGCC_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include\ -DFIXED_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/include-fixed\ -DGPLUSPLUS_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/../../../../include/c++/5.0.0\ -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=0 -DGPLUSPLUS_TOOL_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/../../../../include/c++/5.0.0/x86_64-apple-darwin14.0.0\ -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/../../../../include/c++/5.0.0/backward\ -DLOCAL_INCLUDE_DIR=\/usr/local/include\ -DCROSS_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/../../../../x86_64-apple-darwin14.0.0/sys-include\ -DTOOL_INCLUDE_DIR=\/sw/lib/gcc5.0/lib/gcc/x86_64-apple-darwin14.0.0/5.0.0/../../../../x86_64-apple-darwin14.0.0/include\ -DNATIVE_SYSTEM_HEADER_DIR=\/usr/include\ -DPREFIX=\/sw/lib/gcc5.0/\ -DSTANDARD_EXEC_PREFIX=\/sw/lib/gcc5.0/lib/gcc/\ ../../gcc-5-20141114/gcc/config/darwin-c.c ../../gcc-5-20141114/gcc/config/darwin-c.c: In function ‘const char* version_as_modern_macro(const long unsigned int*)’: ../../gcc-5-20141114/gcc/config/darwin-c.c:711:7: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] != ((major 9) ? sizeof 99 : sizeof 9) - 1) ^ cc1plus: all warnings being treated as errors ../../gcc-5-20141114/gcc/config/t-darwin:26: recipe for target 'darwin-c.o' failed make[3]: *** [darwin-c.o] Error 1 make[3]: Leaving directory '/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc' Makefile:4368: recipe for target 'all-stage2-gcc' failed make[2]: *** [all-stage2-gcc] Error 2 make[2]: Leaving directory '/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir' Makefile:20616: recipe for target 'stage2-bubble' failed make[1]: *** [stage2-bubble] Error 2 make[1]: Leaving directory '/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir' Makefile:906: recipe for target 'all' failed make: *** [all] Error 2
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #7 from Lawrence Velázquez larryv at macports dot org --- (In reply to howarth from comment #6) ../../gcc-5-20141114/gcc/config/darwin-c.c: In function ‘const char* version_as_modern_macro(const long unsigned int*)’: ../../gcc-5-20141114/gcc/config/darwin-c.c:711:7: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] != ((major 9) ? sizeof 99 : sizeof 9) - 1) ^ Seriously?
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33968|0 |1 is obsolete|| --- Comment #8 from Lawrence Velázquez larryv at macports dot org --- Created attachment 33975 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33975action=edit updated trunk patch that satisfies -Werror=sign-compare
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33975|updated trunk patch that|patch against trunk for description|satisfies |handling deployment targets |-Werror=sign-compare|correctly --- Comment #9 from Lawrence Velázquez larryv at macports dot org --- Comment on attachment 33975 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33975 patch against trunk for handling deployment targets correctly diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index ffefa37..311cdd4 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -590,42 +590,167 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) return 0; } -/* Return the value of darwin_macosx_version_min suitable for the - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, so '10.4.2' - becomes 1040 and '10.10.0' becomes 101000. The lowest digit is - always zero, as is the second lowest for '10.10.x' and above. - Print a warning if the version number can't be understood. */ +/* Given a version string, return the version as a statically-allocated +array of three non-negative integers. If the version string is +invalid, return null. + +Version strings must consist of one, two, or three tokens, each +separated by a single period. Each token must contain only the +characters '0' through '9' and is converted to an equivalent +integer. Omitted tokens are treated as zeros. For example: + +10 becomes {10,0,0} +10.10 becomes {10,10,0} +10.10.1 becomes {10,10,1} +10.10.1 becomes {10,10,1} +10.010.001 becomes {10,10,1} +10.10.1 becomes {10,10,1} */ + +enum version_components { MAJOR, MINOR, TINY }; + +static const unsigned long * +parse_version (const char *version_str) +{ + size_t version_len; + char *end; + static unsigned long version_array[3]; + + if (! version_str) +return NULL; + + version_len = strlen (version_str); + if (version_len 1) +return NULL; + + /* Version string must consist of digits and periods only. */ + if (strspn (version_str, 0123456789.) != version_len) +return NULL; + + if (! ISDIGIT (version_str[0]) || ! ISDIGIT (version_str[version_len - 1])) +return NULL; + + version_array[MAJOR] = strtoul (version_str, end, 10); + version_str = end + ((*end == '.') ? 1 : 0); + + /* Version string must not contain adjacent periods. */ + if (*version_str == '.') +return NULL; + + version_array[MINOR] = strtoul (version_str, end, 10); + version_str = end + ((*end == '.') ? 1 : 0); + + version_array[TINY] = strtoul (version_str, end, 10); + + /* Version string must contain no more than three tokens. */ + if (*end != '\0') +return NULL; + + return version_array; +} + +/* Given a three-component version represented as an array of +non-negative integers, return a statically-allocated string suitable +for the legacy __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro. +If the version is invalid and cannot be coerced into a valid form, +return null. + +The legacy format is a four-character string -- two chars for the +major number and one each for the minor and tiny numbers. Major +numbers are zero-padded if necessary. Minor and tiny numbers from +10 through 99 are permitted but are clamped to 9 (for example, +{10,9,10} produces 1099). Versions containing numbers greater +than 99 are rejected. */ + static const char * -version_as_macro (void) +version_as_legacy_macro (const unsigned long *version) { - static char result[7] = 1000; - int minorDigitIdx; + unsigned long major = version[MAJOR]; + unsigned long minor = version[MINOR]; + unsigned long tiny = version[TINY]; + static char result[sizeof ]; - if (strncmp (darwin_macosx_version_min, 10., 3) != 0) + if (major 99 || minor 99 || tiny 99) +return NULL; + + minor = ((minor 9) ? 9 : minor); + tiny = ((tiny 9) ? 9 : tiny); + + /* NOTE: Cast result of sizeof so that result of sprintf is not + converted to an unsigned type. */ + if (sprintf (result, %02lu%lu%lu, major, minor, tiny) + != (int) sizeof - 1) +return NULL; + + return result; +} + +/* Given a three-component version represented as an array of +non-negative integers, return a statically-allocated string suitable +for the modern __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro +or the __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ macro. If the +version is invalid, return null. + +The modern format is a five- or six-character string -- one or two +chars for the major number and two each for the minor and tiny +
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33969|0 |1 is obsolete|| --- Comment #10 from Lawrence Velázquez larryv at macports dot org --- Created attachment 33976 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33976action=edit patch against 4.9 branch for handling deployment targets correctly New 4.9 patch that should satisfy -Werror=sign-compare.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Lawrence Velázquez larryv at macports dot org changed: What|Removed |Added Attachment #33970|0 |1 is obsolete|| --- Comment #11 from Lawrence Velázquez larryv at macports dot org --- Created attachment 33977 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33977action=edit patch against 4.8 branch for handling deployment targets correctly Updated patch that should satisfy -Werror=sign-compare.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 --- Comment #2 from Lawrence Velázquez larryv at macports dot org --- (In reply to Jeremy Huddleston Sequoia from comment #1) Larry said that he's working on a patch to fix this for gcc trunk, and I suspect he's pretty close to having something since that was about a week ago. I just completed the fix and will attach it as soon as I verify that GCC builds with it and that the tests I added pass.
[Bug target/63810] gcc sets incorrect macro for OS X deployment targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 Francois-Xavier Coudert fxcoudert at gcc dot gnu.org changed: What|Removed |Added Target||*-*-darwin* Status|UNCONFIRMED |NEW Last reconfirmed||2014-11-11 Component|driver |target Host||*-*-darwin* Version|unknown |5.0 Ever confirmed|0 |1 Build||*-*-darwin*