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]

[v3] libsupc++ namespace safe, build tweaks



Alex this should fix your glibc 2.1.x problem. 

As for the rest of this stuff... tweaks to libsupc++ to allow it to
build when all "C" headers are exclusively in a _C_legacy namespace,
then aliased in to std. The prototype c_legacy implementation found
this stuff.... I don't have errno, stdfiles, or LC_* bits done
correctly, but everything else seems to work.

-benjamin

tested x86/linux
branch and trunk........

2001-06-09  Benjamin Kosnik  <bkoz@redhat.com>

	* acinclude.m4 (GLIBCPP_CHECK_WCHAR_T_SUPPORT): Check for fgetwc,
	fgetws.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* include/c_std/bits/std_cwchar.h: Remove duplicate fgetwc
	injection, guard fgetwc, fgetws.
	* include/c_std/bits/std_cstdio.h: Remove superfluous includes.
	* include/c_std/bits/std_clocale.h: And here.
	* include/c_std/bits/std_cctype.h: And here.
	* include/c_std/bits/std_cstdlib.h (strtof): Guard strtof injection.

	* config/basic_file_stdio.h: Don't include unistd.h.
	* config/c_io_stdio.h: Don't use compatibility headers.
	* libsupc++/eh_terminate.cc: Qualify abort.
	(__terminate): And here.
	* libsupc++/eh_catch.cc (__cxa_end_catch): Qualify abort.

Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.151
diff -c -p -r1.151 acinclude.m4
*** acinclude.m4	2001/06/08 03:53:23	1.151
--- acinclude.m4	2001/06/09 06:39:42
*************** AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, 
*** 813,818 ****
--- 813,821 ----
      AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
      wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
    
+     dnl Do quick checks for things injected into std:: by the c_std headers.
+     AC_CHECK_FUNCS(fgetwc, fgetws)
+ 
      AC_MSG_CHECKING([for ISO C99 wchar_t support])
      if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
         && test x"$ac_wfuncs" = xyes; then
Index: config/basic_file_stdio.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/basic_file_stdio.h,v
retrieving revision 1.2
diff -c -p -r1.2 basic_file_stdio.h
*** basic_file_stdio.h	2001/03/27 03:48:16	1.2
--- basic_file_stdio.h	2001/06/09 06:40:25
***************
*** 31,38 ****
  // ISO C++ 14882: 27.8  File-based streams
  //
  
- #include <unistd.h>
- 
  namespace std 
  {
    // Generic definitions for __basic_file
--- 31,36 ----
Index: config/c_io_stdio.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/c_io_stdio.h,v
retrieving revision 1.9
diff -c -p -r1.9 c_io_stdio.h
*** c_io_stdio.h	2001/06/08 03:53:31	1.9
--- c_io_stdio.h	2001/06/09 06:40:25
***************
*** 32,39 ****
  #ifndef _CPP_IO_STDIO_H
  #define _CPP_IO_STDIO_H 1
  
! #include <stdio.h>
! #include <stddef.h>
  #include <bits/gthr.h>
  
  namespace std 
--- 32,39 ----
  #ifndef _CPP_IO_STDIO_H
  #define _CPP_IO_STDIO_H 1
  
! #include <cstdio>
! #include <cstddef>
  #include <bits/gthr.h>
  
  namespace std 
Index: include/c_std/bits/std_cctype.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/bits/std_cctype.h,v
retrieving revision 1.5
diff -c -p -r1.5 std_cctype.h
*** std_cctype.h	2001/06/08 23:22:25	1.5
--- std_cctype.h	2001/06/09 06:40:27
***************
*** 34,41 ****
  #ifndef _CPP_CCTYPE
  #define _CPP_CCTYPE 1
  
- #include <bits/c++config.h>
- 
  #pragma GCC system_header
  #include_next <ctype.h>
  
--- 34,39 ----
Index: include/c_std/bits/std_clocale.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/bits/std_clocale.h,v
retrieving revision 1.6
diff -c -p -r1.6 std_clocale.h
*** std_clocale.h	2001/06/08 23:22:25	1.6
--- std_clocale.h	2001/06/09 06:40:27
***************
*** 34,41 ****
  #ifndef _CPP_CLOCALE
  #define _CPP_CLOCALE 1
  
- #include <bits/c++config.h>
- 
  #pragma GCC system_header
  #include_next <locale.h>
  
--- 34,39 ----
Index: include/c_std/bits/std_cstdio.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/bits/std_cstdio.h,v
retrieving revision 1.9
diff -c -p -r1.9 std_cstdio.h
*** std_cstdio.h	2001/06/08 23:22:26	1.9
--- std_cstdio.h	2001/06/09 06:40:27
***************
*** 34,43 ****
  #ifndef _CPP_CSTDIO
  #define _CPP_CSTDIO 1
  
- #include <bits/c++config.h>
- #include <bits/std_cstdarg.h>
- #include <bits/std_cstddef.h>
- 
  #pragma GCC system_header
  #include_next <stdio.h>
  
--- 34,39 ----
Index: include/c_std/bits/std_cstdlib.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/bits/std_cstdlib.h,v
retrieving revision 1.13
diff -c -p -r1.13 std_cstdlib.h
*** std_cstdlib.h	2001/06/09 04:24:10	1.13
--- std_cstdlib.h	2001/06/09 06:40:28
***************
*** 44,50 ****
  #undef atoi
  #undef atol
  #undef strtod
! //#undef strtof
  #undef strtol
  #undef strtoul
  #undef rand
--- 44,50 ----
  #undef atoi
  #undef atol
  #undef strtod
! #undef strtof
  #undef strtol
  #undef strtoul
  #undef rand
*************** namespace std 
*** 88,94 ****
    using ::atoi;
    using ::atol;
    using ::strtod;
!   //  using ::strtof;
    using ::strtol;
    using ::strtoul;
    using ::rand;
--- 88,96 ----
    using ::atoi;
    using ::atol;
    using ::strtod;
! #if _GLIBCPP_HAVE_STRTOF
!   using ::strtof;
! #endif
    using ::strtol;
    using ::strtoul;
    using ::rand;
Index: include/c_std/bits/std_cwchar.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_std/bits/std_cwchar.h,v
retrieving revision 1.12
diff -c -p -r1.12 std_cwchar.h
*** std_cwchar.h	2001/06/08 23:22:26	1.12
--- std_cwchar.h	2001/06/09 06:40:28
*************** namespace std
*** 127,135 ****
  
    using ::btowc;
    using ::wctob;
    using ::fgetwc;
!   using ::fgetwc;
    using ::fgetws;
    using ::fputwc;
    using ::fputws;
    using ::fwide;
--- 127,138 ----
  
    using ::btowc;
    using ::wctob;
+ #if _GLIBCPP_HAVE_FGETWC
    using ::fgetwc;
! #endif
! #if _GLIBCPP_HAVE_FGETWS
    using ::fgetws;
+ #endif
    using ::fputwc;
    using ::fputws;
    using ::fwide;
Index: libsupc++/eh_catch.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/eh_catch.cc,v
retrieving revision 1.1
diff -c -p -r1.1 eh_catch.cc
*** eh_catch.cc	2001/03/28 11:04:50	1.1
--- eh_catch.cc	2001/06/09 06:40:28
*************** __cxa_end_catch ()
*** 89,95 ****
      }
    else if (count < 0)
      // A bug in the exception handling library or compiler.
!     abort ();
  
    header->handlerCount = count;
  }
--- 89,95 ----
      }
    else if (count < 0)
      // A bug in the exception handling library or compiler.
!     std::abort ();
  
    header->handlerCount = count;
  }
Index: libsupc++/eh_terminate.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc,v
retrieving revision 1.1
diff -c -p -r1.1 eh_terminate.cc
*** eh_terminate.cc	2001/03/28 11:04:50	1.1
--- eh_terminate.cc	2001/06/09 06:40:29
***************
*** 37,43 ****
  using namespace __cxxabiv1;
  
  /* The current installed user handlers.  */
! std::terminate_handler __cxxabiv1::__terminate_handler = abort;
  std::unexpected_handler __cxxabiv1::__unexpected_handler = std::terminate;
  
  void
--- 37,43 ----
  using namespace __cxxabiv1;
  
  /* The current installed user handlers.  */
! std::terminate_handler __cxxabiv1::__terminate_handler = std::abort;
  std::unexpected_handler __cxxabiv1::__unexpected_handler = std::terminate;
  
  void
*************** __cxxabiv1::__terminate (std::terminate_
*** 45,53 ****
  {
    try {
      handler ();
!     abort ();
    } catch (...) {
!     abort ();
    }
  }
  
--- 45,53 ----
  {
    try {
      handler ();
!     std::abort ();
    } catch (...) {
!     std::abort ();
    }
  }
  


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