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]

[Patch:3.3 branch] Fix sysroot logic in cppinit.c


Hi

This patch to gcc-3.3 branch:

2003-11-06  H.J. Lu <hongjiu.lu@intel.com>

	* cppinit.c (init_standard_includes): Updated.
<...>
which backported the sysroot functionality from 3.4 causes problems
with relocatability of gcc toolset on mingw targets.

In cppinit.c (init_standard_includes), the conditional 

 	      if (p->add_sysroot && CPP_OPTION (pfile, sysroot))
  		continue;

is always true, because CPP_OPTION (pfile, sysroot) expands to
this default (in cppdefault.c)

const char *cpp_SYSROOT = "";

We need to check that *cpp_SYSROOT is not '\0'.

In 3.4 branch, the logic is slightly diferemt and  check for a NULL pointer
is sufficient.

The following patch is agaainst gcc-3.3.3 release.

Danny

ChangeLog

2004-02-29  Danny Smith  <dannysmith@users.sourceforge.net>

	* cppinit.c (init_standard_includes): Check that sysroot
	string is not empty.

Index: gcc/gcc/cppinit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
retrieving revision 1.264.4.4
diff -c -3 -p -r1.264.4.4 cppinit.c
*** gcc/gcc/cppinit.c	18 Nov 2003 22:23:47 -0000	1.264.4.4
--- gcc/gcc/cppinit.c	18 Feb 2004 21:21:21 -0000
*************** init_standard_includes (pfile)
*** 818,824 ****
  	      /* 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?  */
--- 818,825 ----
  	      /* 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)
! 		  && *(CPP_OPTION (pfile, sysroot)))
  		continue;
  
  	      /* Does this dir start with the prefix?  */
*************** init_standard_includes (pfile)
*** 850,856 ****
  	  char *str;
  
  	  /* Should this dir start with the sysroot?  */
! 	  if (p->add_sysroot && CPP_OPTION (pfile, sysroot))
  	    str = concat (CPP_OPTION (pfile, sysroot), p->fname, NULL);
  
  	  else
--- 851,858 ----
  	  char *str;
  
  	  /* Should this dir start with the sysroot?  */
! 	  if (p->add_sysroot && CPP_OPTION (pfile, sysroot)
! 	      && *(CPP_OPTION (pfile, sysroot)))
  	    str = concat (CPP_OPTION (pfile, sysroot), p->fname, NULL);
  
  	  else

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com


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