2004-10-18 Jakub Jelinek * c-cppbuiltin.c (define__GNUC__): Also define __GNUC_RH_RELEASE__. --- gcc/c-cppbuiltin.c.jj 2004-03-08 18:48:58.000000000 +0100 +++ gcc/c-cppbuiltin.c 2004-10-18 16:40:14.450009521 +0200 @@ -254,14 +254,14 @@ define__GNUC__ (void) { /* The format of the version string, enforced below, is ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? */ - const char *q, *v = version_string; + const char *q, *v = version_string, *vstart, *vend; while (*v && ! ISDIGIT (*v)) v++; if (!*v || (v > version_string && v[-1] != '-')) abort (); - q = v; + vstart = q = v; while (ISDIGIT (*v)) v++; builtin_define_with_value_n ("__GNUC__", q, v - q); @@ -289,6 +289,30 @@ define__GNUC__ (void) if (*v && *v != ' ' && *v != '-') abort (); + + vend = v; + v = strchr (v, '('); + if (v != NULL && strncmp (v + 1, "Red Hat ", 8) == 0) + { + v += 9; + if (strncmp (v, "Linux ", 6) == 0) + v += 6; + + if (strncmp (v, vstart, vend - vstart) != 0 + || v[vend - vstart] != '-') + abort (); + + v += vend - vstart + 1; + q = v; + if (!ISDIGIT (*v)) + abort (); + while (ISDIGIT (*v)) + v++; + builtin_define_with_value_n ("__GNUC_RH_RELEASE__", q, v - q); + + if (*v && *v != ')' && *v != '.') + abort (); + } } /* Hook that registers front end and target-specific built-ins. */