This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix sysroot breakage on 3.3 branch


The sysroot patch on the 3.3 branch breaks -iprefix, which shows up as
numerous testsuite regressions for crosscompilers built without sysroot
support.  See http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01650.html for
details of the breakage when it occurred on mainline.

	Backport 2003-03-26  Alan Modra  <amodra@bigpond.net.au>
	* cppinit.c (init_standard_includes): Add both "translated" and
	non-translated header paths.

Tested powerpc64-linux.  OK?

diff -urpN -xCVS -x'*~' -x'*.info*' -x'*.[17]' -xTAGS gcc-ppc64-33.orig/gcc/cppinit.c gcc-ppc64-33/gcc/cppinit.c
--- gcc-ppc64-33.orig/gcc/cppinit.c	2003-11-09 12:41:31.000000000 +1030
+++ gcc-ppc64-33/gcc/cppinit.c	2003-11-18 00:58:38.000000000 +1030
@@ -805,6 +805,39 @@ init_standard_includes (pfile)
 
       memcpy (default_prefix, cpp_GCC_INCLUDE_DIR, default_len);
       default_prefix[default_len] = '\0';
+
+      for (p = cpp_include_defaults; p->fname; p++)
+	{
+	  /* Some standard dirs are only for C++.  */
+	  if (!p->cplusplus
+	      || (CPP_OPTION (pfile, cplusplus)
+		  && !CPP_OPTION (pfile, no_standard_cplusplus_includes)))
+	    {
+	      char *str;
+
+	      /* Should we be translating sysrooted dirs too?  Assume
+		 that iprefix and sysroot are mutually exclusive, for
+		 now.  */
+	      if (p->add_sysroot && CPP_OPTION (pfile, sysroot))
+		continue;
+
+	      /* Does this dir start with the prefix?  */
+	      if (!strncmp (p->fname, default_prefix, default_len))
+		{
+		  /* Yes; change prefix and add to search list.  */
+		  int flen = strlen (p->fname);
+		  int this_len = specd_len + flen - default_len;
+
+		  str = (char *) xmalloc (this_len + 1);
+		  memcpy (str, specd_prefix, specd_len);
+		  memcpy (str + specd_len,
+			  p->fname + default_len,
+			  flen - default_len + 1);
+
+		  append_include_chain (pfile, str, SYSTEM, p->cxx_aware);
+		}
+	    }
+	}
     }
 
   for (p = cpp_include_defaults; p->fname; p++)
@@ -820,21 +853,6 @@ init_standard_includes (pfile)
 	  if (p->add_sysroot && CPP_OPTION (pfile, sysroot))
 	    str = concat (CPP_OPTION (pfile, sysroot), p->fname, NULL);
 
-	  /* Does this dir start with the prefix?  */
-	  else if (default_len
-		   && !strncmp (p->fname, default_prefix, default_len))
-	    {
-	      /* Yes; change prefix and add to search list.  */
-	      int flen = strlen (p->fname);
-	      int this_len = specd_len + flen - default_len;
-
-	      str = (char *) xmalloc (this_len + 1);
-	      memcpy (str, specd_prefix, specd_len);
-	      memcpy (str + specd_len,
-		      p->fname + default_len,
-		      flen - default_len + 1);
-	    }
-
 	  else
 	    str = update_path (p->fname, p->component);
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]