diff options
Diffstat (limited to 'gcc/c-cppbuiltin.c')
-rw-r--r-- | gcc/c-cppbuiltin.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 8573b8c5a46..39a37059f93 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -31,6 +31,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "except.h" /* For USING_SJLJ_EXCEPTIONS. */ #include "toplev.h" #include "tm_p.h" /* Target prototypes. */ +/* APPLE LOCAL begin pascal strings */ +#include "cpplib.h" +#include "cpphash.h" +/* APPLE LOCAL end pascal strings */ #ifndef TARGET_OS_CPP_BUILTINS # define TARGET_OS_CPP_BUILTINS() @@ -289,6 +293,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. */ |