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 06904dbb5e5..54a44f390af 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -294,6 +294,32 @@ define__GNUC__ (void) builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", "0", 1); gcc_assert (!*v || *v == ' ' || *v == '-'); + + /* 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 */ } /* Define macros used by <stdint.h>. Currently only defines limits |