Blame SOURCES/gcc32-gnuc-rh-release.patch

4ac4fd
2005-11-10  Alexandre Oliva  <aoliva@redhat.com>
4ac4fd
4ac4fd
	* gcc.c (cpp_unique_options): Add %vR.
4ac4fd
	(do_spec_1): Use it to define __GNUC_RH_RELEASE__.
4ac4fd
4ac4fd
--- gcc/gcc.c	2005-11-10 14:59:39.000000000 -0200
4ac4fd
+++ gcc/gcc.c	2005-11-10 15:47:01.000000000 -0200
4ac4fd
@@ -696,7 +696,7 @@
4ac4fd
  %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}}\
4ac4fd
  %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
4ac4fd
  %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}}\
4ac4fd
- %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3 -D__GXX_ABI_VERSION=102}\
4ac4fd
+ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3 %vR -D__GXX_ABI_VERSION=102}\
4ac4fd
  %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
4ac4fd
  %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
4ac4fd
  %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\
4ac4fd
@@ -5226,7 +5226,7 @@
4ac4fd
 
4ac4fd
 	      /* If desired, advance to third version number.
4ac4fd
                  But don't complain if it's not present */
4ac4fd
-	      if (c1 == '3')
4ac4fd
+	      if (c1 >= '3')
4ac4fd
 		{
4ac4fd
 		  /* Set V after the second period.  */
4ac4fd
 		  while (ISDIGIT (*v))
4ac4fd
@@ -5237,11 +5237,45 @@
4ac4fd
 		    v++;
4ac4fd
 		}
4ac4fd
 
4ac4fd
+	      if (c1 == 'R')
4ac4fd
+		{
4ac4fd
+		  /* Move q to the end of compiler_version, so that we
4ac4fd
+		     can compare the beginning of compiler_version
4ac4fd
+		     with the beginning of version_string below.  */
4ac4fd
+		  q = v + strlen (v);
4ac4fd
+
4ac4fd
+		  v = strchr (version_string, '(');
4ac4fd
+		  if (v != NULL && strncmp (v + 1, "Red Hat ", 8) == 0)
4ac4fd
+		    {
4ac4fd
+		      v += 9;
4ac4fd
+		      if (strncmp (v, "Linux ", 6) == 0)
4ac4fd
+			v += 6;
4ac4fd
+
4ac4fd
+		      /* If compiler_version changed, don't define
4ac4fd
+			 __GNUC_RH_RELEASE__.  */
4ac4fd
+		      if (strncmp (v, compiler_version, q - compiler_version)
4ac4fd
+			  != 0)
4ac4fd
+			break;
4ac4fd
+
4ac4fd
+		      if (strncmp (v, version_string, q - compiler_version)
4ac4fd
+			  != 0 || v[q - compiler_version] != '-')
4ac4fd
+			abort ();
4ac4fd
+
4ac4fd
+		      /* Skip the version and the dash.  */
4ac4fd
+		      v += q - compiler_version + 1;
4ac4fd
+		      obstack_grow (&obstack, "-D__GNUC_RH_RELEASE__=",
4ac4fd
+				    sizeof ("-D__GNUC_RH_RELEASE__=") - 1);
4ac4fd
+		    }
4ac4fd
+		  else
4ac4fd
+		    break;
4ac4fd
+		}
4ac4fd
+
4ac4fd
 	      /* Set Q at the next period or at the end.  */
4ac4fd
 	      q = v;
4ac4fd
 	      while (ISDIGIT (*q))
4ac4fd
 		q++;
4ac4fd
-	      if (*q != 0 && q > v && *q != ' ' && *q != '.' && *q != '-')
4ac4fd
+	      if (*q != 0 && q > v && *q != ' ' && *q != '.' && *q != '-'
4ac4fd
+		  && *q != ')')
4ac4fd
 		abort ();
4ac4fd
 
4ac4fd
 	      if (q > v)