diff options
Diffstat (limited to 'gcc/c-cppbuiltin.c')
-rw-r--r-- | gcc/c-cppbuiltin.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 8573b8c5a46..f8ea6b266e9 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -289,6 +289,32 @@ define__GNUC__ (void) if (*v && *v != ' ' && *v != '-') abort (); + + /* APPLE LOCAL begin Apple version */ + { + /* This chunk of code defines __APPLE_CC__ from the version + string. It expects to see a substring of the version string of + the form "build NNNN)", where each N is a digit, and the first + N is nonzero (there can be 4 or 5 digits). It will abort() if + these conditions are not met, since that usually means that + someone's broken the version string. */ + const char *vt; + + vt = strstr (version_string, "build "); + if (vt == NULL) + abort (); + vt += strlen ("build "); + if (! ISDIGIT (*vt)) + abort (); + for (q = vt; *q != 0 && ISDIGIT (*q); q++) + ; + if (q == vt || *q != ')') + abort (); + if ((q - vt != 4 && q - vt != 5) || *vt == '0') + abort (); + builtin_define_with_value_n ("__APPLE_CC__", vt, q - vt); + } + /* APPLE LOCAL end Apple version */ } /* Hook that registers front end and target-specific built-ins. */ |