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]

Re: [PATCH, PR46650] Fix --enable-build-with-cxx bootstrap failure


On Sat, Nov 27, 2010 at 09:45:09AM +0100, Ralf Wildenhues wrote:
> Hello Jack,
> 
> * Jack Howarth wrote on Thu, Nov 25, 2010 at 09:20:30PM CET:
> >   Currently the --enable-build-with-cxx bootstrap is broken due to r167010
> > which poisoned the strerror macro. The attached patch implements the proposed
> > solution of including the cstring c++ header instead of string.h and/or strings.h
> > when __cplusplus is defined. Bootstrap and regression tested on x86_64-apple-darwin10.
> 
> > 2010-11-25  Jack Howarth <howarth@bromo.med.uc.edu>
> >             Joseph Myers <joseph@codesourcery.com>
> > 
> > 	PR bootstrap/46650
> > 	* gcc/system.h: Include cstring for cxx bootstrap.
> 
> > --- gcc/system.h	(revision 167136)
> > +++ gcc/system.h	(working copy)
> > @@ -194,15 +194,19 @@
> >     rely on (and therefore test) GCC's string builtins.  */
> >  #define __NO_STRING_INLINES
> >  
> > -#ifdef STRING_WITH_STRINGS
> > -# include <string.h>
> > -# include <strings.h>
> > +#ifdef __cplusplus
> > +# include <cstring>
> 
> I'm not sure I understand why you can leave out strings.h in this case.
> For example, Posix states that strcasecmp is declared in that header, we
> use that function, and the cstring header implementation from
> libstdc++-v3 does not include strings.h.

Ralf,
   A reduced patch of just...

Index: system.h
===================================================================
--- system.h	(revision 167200)
+++ system.h	(working copy)
@@ -194,6 +194,10 @@
    rely on (and therefore test) GCC's string builtins.  */
 #define __NO_STRING_INLINES
 
+#ifdef __cplusplus
+# include <cstring>
+#endif
+
 #ifdef STRING_WITH_STRINGS
 # include <string.h>
 # include <strings.h>

...also solves the breakage of --enable-build-with-cxx by r167010 and
fully bootstraps on x86_64-apple-darwin10. I'll post the revised patch
after regression testing is complete.
            Jack

> 
> >  #else
> > -# ifdef HAVE_STRING_H
> > +# ifdef STRING_WITH_STRINGS
> >  #  include <string.h>
> > +#  include <strings.h>
> >  # else
> > -#  ifdef HAVE_STRINGS_H
> > -#   include <strings.h>
> > +#  ifdef HAVE_STRING_H
> > +#   include <string.h>
> > +#  else
> > +#   ifdef HAVE_STRINGS_H
> > +#    include <strings.h>
> > +#   endif
> >  #  endif
> >  # endif
> >  #endif
> 
> Cheers,
> Ralf


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