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] enable wchar_t for stdio model



...this enables the wide character code, providing the target passes
all the configuration checks. In practice, linux and perhaps bsd,
solaris will pass these configure tests. 

Now things like wfprintf and wstring, wstringbuf, etc will work. The
wide c++ file io bits still are not done or in an especially useful
state, but they are now visible in the headers and can be linked.

This is a pretty significant change, so I'm going to check it into
mainline and see what goes boom. Eventually it should migrate to the
gcc-3 branch.

-benjamin

x86/linux

2001-02-28  Benjamin Kosnik  <bkoz@redhat.com>

	libstdc++/2103
	* include/bits/c++config (__GLIBCPP__): Bump number in
	anticipation of 2.92.

	* include/bits/codecvt.h: Fix typo.
	* include/bits/basic_file.h (__basic_file): Don't use _M_wfile for
	stdio model.
	* acinclude.m4 (GLIBCPP_ENABLE_CSTDIO): Enable wchar_t
	instantiations for stdio model.

Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.134
diff -c -p -r1.134 acinclude.m4
*** acinclude.m4	2001/02/28 18:42:45	1.134
--- acinclude.m4	2001/03/01 00:31:37
*************** AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
*** 1163,1170 ****
        # We're not using stdio.
        need_libio=no
        need_wlibio=no
-       # Wide characters are not supported with this package.
-       enable_c_mbchar=no
        ;;
      *)
        echo "$enable_cstdio is an unknown io package" 1>&2
--- 1163,1168 ----
Index: include/bits/basic_file.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/basic_file.h,v
retrieving revision 1.5
diff -c -p -r1.5 basic_file.h
*** basic_file.h	2001/02/28 03:20:35	1.5
--- basic_file.h	2001/03/01 00:31:38
*************** namespace std 
*** 114,120 ****
    // Also note that the order and number of virtual functions has to precisely
    // match the order and number in the _IO_jump_t struct defined in libioP.h.
    template<typename _CharT>
! #if _GLIBCPP_BASIC_FILE_INHERITANCE
      class __basic_file: public __basic_file_base<_CharT>
  #else
      class __basic_file
--- 114,120 ----
    // Also note that the order and number of virtual functions has to precisely
    // match the order and number in the _IO_jump_t struct defined in libioP.h.
    template<typename _CharT>
! #ifdef _GLIBCPP_BASIC_FILE_INHERITANCE
      class __basic_file: public __basic_file_base<_CharT>
  #else
      class __basic_file
*************** namespace std 
*** 123,132 ****
  #if _GLIBCPP_BASIC_FILE_ENCAPSULATION
        int 		_M_fileno;
        __c_file_type* 	_M_cfile;
! #endif
! #ifdef _GLIBCPP_USE_WCHAR_T
        __c_wfile_type	_M_wfile;
! #endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
  
      public:
        __basic_file(__c_lock* __lock = 0);
--- 123,133 ----
  #if _GLIBCPP_BASIC_FILE_ENCAPSULATION
        int 		_M_fileno;
        __c_file_type* 	_M_cfile;
! #else
! # ifdef _GLIBCPP_USE_WCHAR_T
        __c_wfile_type	_M_wfile;
! # endif
! #endif 
  
      public:
        __basic_file(__c_lock* __lock = 0);
Index: include/bits/codecvt.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/codecvt.h,v
retrieving revision 1.13
diff -c -p -r1.13 codecvt.h
*** codecvt.h	2001/02/23 19:22:04	1.13
--- codecvt.h	2001/03/01 00:31:40
***************
*** 524,530 ****
  	  if (__ext_bom)
  	    {	  
  	      size_t __size = __from_end - __from;
! 	      extern_type* __cfixed = (sizeof(extern_type) * (__size + 1));
  	      __cfixed[0] = static_cast<extern_type>(__ext_bom);
  	      char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
  	      __cfrom = reinterpret_cast<char*>(__cfixed);
--- 524,530 ----
  	  if (__ext_bom)
  	    {	  
  	      size_t __size = __from_end - __from;
! 	      extern_type* __cfixed =  static_cast<extern_type*>(__builtin_alloca(sizeof(extern_type) * (__size + 1)));
  	      __cfixed[0] = static_cast<extern_type>(__ext_bom);
  	      char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
  	      __cfrom = reinterpret_cast<char*>(__cfixed);
Index: include/bits/c++config
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/c++config,v
retrieving revision 1.13
diff -c -p -r1.13 c++config
*** c++config	2001/02/23 07:12:03	1.13
--- c++config	2001/03/01 00:31:41
***************
*** 34,40 ****
  #include <bits/os_defines.h>
  
  // The current version of the C++ library in compressed ISO date format.
! #define __GLIBCPP__ 20010102
  
  // This is necessary until GCC supports separate template
  // compilation.  
--- 34,40 ----
  #include <bits/os_defines.h>
  
  // The current version of the C++ library in compressed ISO date format.
! #define __GLIBCPP__ 20010301
  
  // This is necessary until GCC supports separate template
  // compilation.  
***************
*** 53,59 ****
  //#define _GLIBCPP_DEPRECATED 1
  
  // Use corrected code from the committee library group's issues list.
! # define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
  
  
  // From SGI's stl_config.h; generic settings and user hooks (_NOTHREADS).
--- 53,59 ----
  //#define _GLIBCPP_DEPRECATED 1
  
  // Use corrected code from the committee library group's issues list.
! #define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
  
  
  // From SGI's stl_config.h; generic settings and user hooks (_NOTHREADS).
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.75
diff -c -p -r1.75 Makefile.am
*** Makefile.am	2001/02/28 03:20:36	1.75
--- Makefile.am	2001/03/01 00:31:42
*************** toolexeclibdir = @glibcpp_toolexeclibdir
*** 34,40 ****
  toolexeclib_LTLIBRARIES = libstdc++.la
  EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la
  
- 
  # Compile flags that should be constant throughout the build, both for
  # SUBDIRS and for libstdc++-v3 in general.
  OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
--- 34,39 ----
*************** VPATH += $(top_srcdir) $(top_srcdir)/src
*** 179,187 ****
  VPATH += $(GLIBCPP_INCLUDE_DIR) 
  VPATH += $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR)
  
- # Actual sources for the distro, but don't build these.
- #EXTRA_sources = string-inst.cc 
- 
  libstdc___la_SOURCES = $(sources)
  
  libinst_wstring_la_SOURCES = $(wstring_sources)
--- 178,183 ----
*************** libstdc___la_LDFLAGS = -version-info 3:0
*** 196,201 ****
--- 192,211 ----
  libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
  
  
+ # Use special rules for the deprecated source files so that they find
+ # deprecated include files.
+ strstream.lo: strstream.cc
+ 	$(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ strstream.o: strstream.cc
+ 	$(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
+ 
+ # Make wstring-inst.cc from string-inst.cc
+ wstring-inst.o: string-inst.cc
+ 	$(CXXCOMPILE) -c -DC=wchar_t $< -o $@
+ wstring-inst.lo: string-inst.cc
+ 	$(LTCXXCOMPILE) -c -DC=wchar_t $< -o $@
+ 
+ 
  # Make sure cshadow headers are built first.
  if GLIBCPP_USE_CSHADOW
  CSHADOW_H = $(top_builddir)/stamp-cshadow
*************** myinstallheaders: 
*** 279,298 ****
            $(INSTALL_DATA) $$i $(gxx_include_dir); \
  	done; \
  	fi;
- 
- 
- # Use special rules for the deprecated source files so that they find
- # deprecated include files.
- strstream.lo: strstream.cc
- 	$(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
- strstream.o: strstream.cc
- 	$(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
- 
- # Make wstring-inst.cc from string-inst.cc
- wstring-inst.o: string-inst.cc
- 	$(CXXCOMPILE) -c -DC=wchar_t $< -o $@
- wstring-inst.lo: string-inst.cc
- 	$(LTCXXCOMPILE) -c -DC=wchar_t $< -o $@
  
  
  # Alexandre put this in here for some libtool-related reason.
--- 289,294 ----


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