This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

[v3] how to add missing bits for long long



For demonstration purposes only. People on platforms who are actually
having problems with this should try it out, lemme know what's up.

In particular, the strtoull.c, strtoll.c functions aren't in. As
previously posted as part of another file, they don't even compile. 

I'm hoping somebody else can smooth over the remaining issues, and
finish this.

These issues include, but may not be limited to:
- hackery in certain ports config/os/*/bits/os_defines.h 
- strtoull.c formatting and correctness
- strtoll.c formatting and correctness

I think, at this point, this or something similar should go in.  I
think it will best resolve certain long-running issues with legacy
support of long-long bits in iostreams that v2 supported, but v3 has
been pretty picky about. 

Note this doesn't mean that I think that every platform that loses
with every bit, or wide bits, or narrow bits, or long bits, of the "C"
library should implement replacements and stick them in the libc
subdirectory. Wrong! I'm really not interested in replicating missing "C"
library functionality, and I don't think libstdc++-v3 should either. YMMV.

-benjamin

2002-03-19  Benjamin Kosnik  <bkoz@redhat.com>

	* libc: New.
	* libc/Makefile.am: New.
	* libc/Makefile.in: New.	
	* libc/strtoll.c: New.
	* libc/strtoull.c: New.	
	* src/Makefile.am (libstdc___la_LIBADD): Add libc_lose.la.
	* src/Makefile.in: Regenerate.
	* configure.in: Output libc/Makefile.
	* configure: Regenerate.
	* acinclude.m4 (GLIBCPP_ENABLE_LONG_LONG): Substitue in LIBCOBJS
	if strtoll, strtoull are not found.
	* aclocal.m4: Regenerate.
	* Makefile.am (SUBDIRS): Add libc.
	* Makefile.in: Regenerate.
	
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.200
diff -c -p -r1.200 acinclude.m4
*** acinclude.m4	2002/03/19 19:49:59	1.200
--- acinclude.m4	2002/03/20 05:16:42
*************** AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
*** 1602,1620 ****
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
  
!   AC_MSG_CHECKING([for enabled long long I/O support])
!   # iostreams require strtoll, strtoull to compile
    AC_TRY_COMPILE([#include <stdlib.h>],
!                  [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
    AC_TRY_COMPILE([#include <stdlib.h>],
!                  [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
  
    # Option parsed, now set things appropriately
    if test x"$enable_long_long" = xyes; then
      AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
    fi
-   AC_MSG_RESULT($enable_long_long)
  
    AC_LANG_RESTORE
  ])
  
--- 1602,1628 ----
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
  
!   # iostreams require strtoll, strtoull to compile. Determine if we have 
!   # native versions, or if we need to compile them in ourselves.
!   AC_MSG_CHECKING([for native long long support])
!   native_ll=yes ;
    AC_TRY_COMPILE([#include <stdlib.h>],
! 	         [char* tmp; strtoll("gnu", &tmp, 10);], ,
! 	         [native_ll=no, LIBCOBJS="$LIBCOBJS strtoll.lo"])
! 
    AC_TRY_COMPILE([#include <stdlib.h>],
! 	         [char* tmp; strtoull("gnu", &tmp, 10);], ,
! 		 [native_ll=no, LIBCOBJS="$LIBCOBJS strtoull.lo"])
!   AC_MSG_RESULT($native_ll)
  
    # Option parsed, now set things appropriately
    if test x"$enable_long_long" = xyes; then
      AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
+   else
+     LIBCOBJS=""
    fi
  
+   AC_SUBST(LIBCOBJS)
    AC_LANG_RESTORE
  ])
  
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/Makefile.am,v
retrieving revision 1.29
diff -c -p -r1.29 Makefile.am
*** Makefile.am	2002/01/28 22:13:02	1.29
--- Makefile.am	2002/03/20 05:16:42
***************
*** 25,31 ****
  AUTOMAKE_OPTIONS = 1.3 cygnus
  MAINT_CHARSET = latin1
  
! SUBDIRS = include libio libmath libsupc++ src po testsuite 
  
  mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
  
--- 25,31 ----
  AUTOMAKE_OPTIONS = 1.3 cygnus
  MAINT_CHARSET = latin1
  
! SUBDIRS = include libio libc libmath libsupc++ src po testsuite 
  
  mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
  
Index: libc/Makefile.am
===================================================================
RCS file: Makefile.am
diff -N Makefile.am
*** /dev/null	Tue May  5 13:32:27 1998
--- Makefile.am	Tue Mar 19 21:16:42 2002
***************
*** 0 ****
--- 1,44 ----
+ ## Makefile for the libc subdirectory of the GNU C++ Standard library.
+ ##
+ ## Copyright (C) 2002 Free Software Foundation, Inc.
+ ##
+ ## This file is part of the libstdc++ version 3 distribution.
+ ## Process this file with automake to produce Makefile.in.
+ 
+ ## This file is part of the GNU ISO C++ Library.  This library is free
+ ## software; you can redistribute it and/or modify it under the
+ ## terms of the GNU General Public License as published by the
+ ## Free Software Foundation; either version 2, or (at your option)
+ ## any later version.
+ 
+ ## This library is distributed in the hope that it will be useful,
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ ## GNU General Public License for more details.
+ 
+ ## You should have received a copy of the GNU General Public License along
+ ## with this library; see the file COPYING.  If not, write to the Free
+ ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ ## USA.
+ 
+ AUTOMAKE_OPTIONS = 1.3 cygnus
+ 
+ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+ 
+ noinst_LTLIBRARIES = libc_lose.la
+ 
+ libc_lose_la_LIBADD = @LIBCOBJS@ 
+ 
+ libc_lose_la_DEPENDENCIES = $(libc_lose_la_LIBADD)
+ 
+ libc_lose_la_SOURCES = 
+ 
+ LINK = \
+ 	$(LIBTOOL) --tag CC --mode=link "$(CCLD)" \
+ 	$(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+ 
+ # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
+ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+ 
+ INCLUDES = \
+ 	$(TOPLEVEL_INCLUDES) 
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.105
diff -c -p -r1.105 Makefile.am
*** Makefile.am	2002/03/19 19:50:28	1.105
--- Makefile.am	2002/03/20 05:16:42
*************** VPATH = $(top_srcdir)/src:$(top_srcdir)
*** 75,81 ****
  libstdc___la_SOURCES = $(sources)
  
  libstdc___la_LIBADD = \
! 	../libmath/libmath.la @libio_la@ \
  	../libsupc++/libsupc++convenience.la
  
  if GLIBCPP_BUILD_VERSIONED_SHLIB
--- 75,81 ----
  libstdc___la_SOURCES = $(sources)
  
  libstdc___la_LIBADD = \
! 	../libmath/libmath.la ../libc/libc_lose.la @libio_la@ \
  	../libsupc++/libsupc++convenience.la
  
  if GLIBCPP_BUILD_VERSIONED_SHLIB


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