/[gentoo-x86]/sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch
Gentoo

Contents of /sys-devel/gcc-apple/files/gcc-apple-4.2.1_p5666-darwin14.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sat Jan 31 16:15:23 2015 UTC (2 years, 7 months ago) by grobian
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +129 -38 lines
Update darwin14 patch with much better approach by Michael Weisner, not revbumping because darwin14 bootstrapping should be broken anyway

(Portage version: 2.2.14-prefix/cvs/SunOS i386, signed Manifest commit with key 0x5F75F607C5C74E89)

1 https://537826.bugs.gentoo.org/attachment.cgi?id=394896
2 https://bugs.gentoo.org/show_bug.cgi?id=537826
3 Michael Weiser
4
5 Backport of https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=218873 (as
6 per https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407) to correctly encode Mac
7 OS X versions >10.9 into __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__.
8 Extended to also encode patch level the way clang and Apple GCC 4.2.1 do.
9
10 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810 has a much more generic
11 patch. But it's not yet in-tree pending legal paperwork. Once that's done, we
12 can backport that.
13
14 --- gcc/libgcov.c
15 +++ gcc/libgcov.c
16 @@ -34,6 +34,14 @@
17 #include "coretypes.h"
18 #include "tm.h"
19
20 +/* to deal with XBC headers from 10.10 */
21 +#ifndef __has_extension
22 +#define __has_extension(x) 0
23 +#endif
24 +#ifndef __has_feature
25 +#define __has_feature(x) 0
26 +#endif
27 +
28 /* APPLE LOCAL begin instant off 6414141 */
29 #if defined(__APPLE__) && !defined(__STATIC__) && !defined(__ppc__) && !defined(__ppc64__) && !defined(__arm__)
30 #include <vproc.h>
31 --- gcc/config/darwin-driver.c.orig 2010-10-14 22:27:53.000000000 +0200
32 +++ gcc/config/darwin-driver.c 2015-01-25 21:15:09.000000000 +0100
33 @@ -174,8 +174,6 @@
34 version_p = osversion + 1;
35 if (ISDIGIT (*version_p))
36 major_vers = major_vers * 10 + (*version_p++ - '0');
37 - if (major_vers > 4 + 9)
38 - goto parse_failed;
39 if (*version_p++ != '.')
40 goto parse_failed;
41 version_pend = strchr(version_p, '.');
42 --- gcc/config/darwin-c.c.orig 2015-01-25 19:44:40.000000000 +0100
43 +++ gcc/config/darwin-c.c 2015-01-25 21:05:47.000000000 +0100
44 @@ -930,31 +930,91 @@
45
46 /* Return the value of darwin_macosx_version_min suitable for the
47 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
48 - so '10.4.2' becomes 1042.
49 + so '10.4.2' becomes 1042 and '10.10.2' becomes 101002.
50 + Cap patch level to 9 in the old format.
51 Print a warning if the version number is not known. */
52 static const char *
53 /* APPLE LOCAL ARM 5683689 */
54 macosx_version_as_macro (void)
55 {
56 - static char result[] = "1000";
57 + static char result[7] = "1000";
58 + int inputindex = 3, outputindex = 2;
59
60 + /* make sure version starts with "10." - makes sure we can safely start
61 + * parsing at inputindex == 3 */
62 if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
63 goto fail;
64 +
65 + /* first character of minor version needs to be digit */
66 if (! ISDIGIT (darwin_macosx_version_min[3]))
67 goto fail;
68 - result[2] = darwin_macosx_version_min[3];
69 - if (darwin_macosx_version_min[4] != '\0')
70 +
71 + result[outputindex++] = darwin_macosx_version_min[inputindex++];
72 +
73 + if (ISDIGIT (darwin_macosx_version_min[inputindex])) {
74 + /* Starting with OS X 10.10, the macro ends '00' rather than '0',
75 + i.e. 10.10.x becomes 101000 rather than 10100. */
76 + result[outputindex++] = darwin_macosx_version_min[inputindex++];
77 + result[4] = '0';
78 + result[5] = '0';
79 + result[6] = '\0';
80 + }
81 +
82 + /* if we're out of input, leave patch level at 0 or 00 and finish */
83 + if (darwin_macosx_version_min[inputindex] == '\0')
84 + return result;
85 +
86 + /* a dot *must* follow now */
87 + if (darwin_macosx_version_min[inputindex++] != '.')
88 + goto fail;
89 +
90 + /* a digit must follow after the dot */
91 + if (! ISDIGIT (darwin_macosx_version_min[inputindex]))
92 + goto fail;
93 +
94 + /* old-style macro */
95 + if (outputindex == 3)
96 + {
97 + /* one-digit patch level */
98 + if (darwin_macosx_version_min[inputindex + 1] == '\0')
99 {
100 - if (darwin_macosx_version_min[4] != '.')
101 - goto fail;
102 - if (! ISDIGIT (darwin_macosx_version_min[5]))
103 - goto fail;
104 - if (darwin_macosx_version_min[6] != '\0')
105 - goto fail;
106 - result[3] = darwin_macosx_version_min[5];
107 + result[outputindex] = darwin_macosx_version_min[inputindex];
108 + return result;
109 }
110 - else
111 - result[3] = '0';
112 +
113 + inputindex++;
114 + if (! ISDIGIT (darwin_macosx_version_min[inputindex++]))
115 + goto fail;
116 +
117 + /* three digits? */
118 + if (darwin_macosx_version_min[inputindex] != '\0')
119 + goto fail;
120 +
121 + /* no room for another digit. Traditional Apple GCC 4.2.1 doesn't accept
122 + * it but current clang caps it to 9. We choose to be in line with clang. */
123 + result[outputindex] = '9';
124 + return result;
125 + }
126 +
127 + /* new-style macro */
128 +
129 + /* leave a leading zero if only one digit is following */
130 + if (darwin_macosx_version_min[inputindex + 1] == '\0') {
131 + result[outputindex + 1] = darwin_macosx_version_min[inputindex];
132 + return result;
133 + }
134 +
135 + result[outputindex++] = darwin_macosx_version_min[inputindex++];
136 +
137 + /* a digit must follow now */
138 + if (! ISDIGIT (darwin_macosx_version_min[inputindex]))
139 + goto fail;
140 +
141 + result[outputindex] = darwin_macosx_version_min[inputindex++];
142 +
143 + /* no more input allowed */
144 + if (darwin_macosx_version_min[inputindex] != '\0')
145 + goto fail;
146
147 return result;
148

  ViewVC Help
Powered by ViewVC 1.1.20