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]

[libstdc++ trunk&3.0] Fix 'long long' I/O vs C99 tests


Briefly:  our tests for whether 'long long' I/O would work were predicated
on whether a slew of C99 features were present, including things which had
naught to do with I/O.  This caused annoyances on platforms like Solaris,
where long long I/O is perfectly okay, but things like _Exit are not present.

After much discussion, this patch was approved.  Its effects are here:

    http://gcc.gnu.org/ml/libstdc++/2001-11/msg00042.html

Bootstrapped with no regressions on i686/linux.  Bootstrapped on cross
to powerpc-sim; testsuite tests all compile and run, but cpplib warnings
cause the dejagnu harness to mark everything as FAIL.

Committed to trunk and branch.  The trunk diff is below.  The branch diff
does not include the src/concept-inst.cc changes, since that file only
exists on the trunk.


2001-11-02  Phil Edwards  <pme@gcc.gnu.org>

	* acconfig.h:  Update comments.
	* acinclude.m4 (GLIBCPP_ENABLE_C99):  Move strtoll, strtoull tests...
	(GLIBCPP_ENABLE_LONG_LONG):  ...to here.  Don't check enable_c99.
	* aclocal.m4:  Regenerate.
	* config.h.in:  Regenerate.
	* configure:  Regenerate.

	* include/bits/boost_concept_check.h:  Unconditionally compile uses
	of 'long long' which require only compiler support, not C lib support.
	* include/bits/cpp_type_traits.h:  Likewise.
	* include/bits/std_limits.h:  Likewise.
	* include/bits/type_traits.h:  Likewise.
	* src/concept-inst.cc:  Likewise.
	* src/limits.cc:  Likewise.
	* include/c_shadow/stdlib.h:  Compile conditionally on _GLIBCPP_USE_C99
	instead of _GLIBCPP_USE_LONG_LONG.
	* include/c_shadow/bits/std_cstdlib.h:  Likewise.


Index: acconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acconfig.h,v
retrieving revision 1.23
diff -u -3 -p -r1.23 acconfig.h
--- acconfig.h	2001/11/01 15:46:46	1.23
+++ acconfig.h	2001/11/02 22:25:58
@@ -10,16 +10,16 @@
 #undef HAVE_GETTEXT
 #undef HAVE_STPCPY
 
-// Define if GCC supports weak symbols
+// Define if GCC supports weak symbols.
 #undef _GLIBCPP_SUPPORTS_WEAK
 
-// Define if gthr-default.h exists (meaning that threading support is enabled)
+// Define if gthr-default.h exists (meaning that threading support is enabled).
 #undef HAVE_GTHR_DEFAULT
 
-// Include support for 'long long' and 'unsigned long long'.
+// Include I/O support for 'long long' and 'unsigned long long'.
 #undef _GLIBCPP_USE_LONG_LONG
 
-// Define if code specialized for wchar_t should be used.
+// Define if C99 features such as lldiv_t, llabs, lldiv should be exposed.
 #undef _GLIBCPP_USE_C99
 
 // Include support for 'long double'.
Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.179
diff -u -3 -p -r1.179 acinclude.m4
--- acinclude.m4	2001/11/01 15:46:46	1.179
+++ acinclude.m4	2001/11/02 22:26:00
@@ -1433,10 +1433,6 @@ AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
 	         [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
   AC_TRY_COMPILE([#include <stdlib.h>],
 	         [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
-  AC_TRY_COMPILE([#include <stdlib.h>],
-	         [char* tmp; strtoll("gnu", &tmp, 10);],, [ac_c99_stdlib=no])
-  AC_TRY_COMPILE([#include <stdlib.h>],
-	         [char* tmp; strtoull("gnu", &tmp, 10);],, [ac_c99_stdlib=no])
   AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
   AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
   AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
@@ -1478,7 +1474,8 @@ AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
 
 dnl
 dnl Check for template specializations for the 'long long' type extension.
-dnl NB: Must check for C99 support before calling _GLIBCPP_ENABLE_LONG_LONG
+dnl The result determines only whether 'long long' I/O is enabled; things
+dnl like numeric_limits<> specializations are always available.
 dnl
 dnl GLIBCPP_ENABLE_LONG_LONG
 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
@@ -1503,15 +1500,15 @@ AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
    esac],
   enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
 
-  # iostreams require strtoll, strtoull to compile. If the
-  # GLIBCPP_ENABLE_C99 tests found these, and if C99 support is enabled,
-  # go ahead and allow long long to be used.
-  if test x"$enable_c99" = x"no"; then
-    enable_long_long=no; 
-  fi
+  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
-  AC_MSG_CHECKING([for enabled long long support])
   if test x"$enable_long_long" = xyes; then
     AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
   fi
Index: include/bits/boost_concept_check.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/boost_concept_check.h,v
retrieving revision 1.5
diff -u -3 -p -r1.5 boost_concept_check.h
--- boost_concept_check.h	2001/11/02 17:38:10	1.5
+++ boost_concept_check.h	2001/11/02 22:26:02
@@ -97,11 +97,9 @@ struct _Aux_require_same<_Tp,_Tp> { type
   template <> struct _IntegerConcept<unsigned int> { void __constraints() {} };
   template <> struct _IntegerConcept<long> { void __constraints() {} };
   template <> struct _IntegerConcept<unsigned long> { void __constraints() {} };
-#ifdef _GLIBCPP_USE_LONG_LONG
   template <> struct _IntegerConcept<long long> { void __constraints() {} };
   template <> struct _IntegerConcept<unsigned long long>
                                                 { void __constraints() {} };
-#endif
 
   template <class _Tp>
   struct _SignedIntegerConcept {
@@ -112,9 +110,7 @@ struct _Aux_require_same<_Tp,_Tp> { type
   template <> struct _SignedIntegerConcept<short> { void __constraints() {} };
   template <> struct _SignedIntegerConcept<int> { void __constraints() {} };
   template <> struct _SignedIntegerConcept<long> { void __constraints() {} };
-#ifdef _GLIBCPP_USE_LONG_LONG
   template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};
-#endif
 
   template <class _Tp>
   struct _UnsignedIntegerConcept {
@@ -128,10 +124,8 @@ struct _Aux_require_same<_Tp,_Tp> { type
     { void __constraints() {} };
   template <> struct _UnsignedIntegerConcept<unsigned long>
     { void __constraints() {} };
-#ifdef _GLIBCPP_USE_LONG_LONG
   template <> struct _UnsignedIntegerConcept<unsigned long long>
     { void __constraints() {} };
-#endif
 
   //===========================================================================
   // Basic Concepts
Index: include/bits/cpp_type_traits.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/cpp_type_traits.h,v
retrieving revision 1.4
diff -u -3 -p -r1.4 cpp_type_traits.h
--- cpp_type_traits.h	2001/11/02 17:38:10	1.4
+++ cpp_type_traits.h	2001/11/02 22:26:02
@@ -200,7 +200,6 @@ namespace std
     };
   };
 
-# ifdef _GLIBCPP_USE_LONG_LONG
   template<>
   struct __is_integer<long long>
   {
@@ -218,7 +217,6 @@ namespace std
       _M_type = 1
     };
   };
-# endif
 
   //
   // Floating point types
Index: include/bits/std_limits.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_limits.h,v
retrieving revision 1.10
diff -u -3 -p -r1.10 std_limits.h
--- std_limits.h	2001/11/02 17:38:10	1.10
+++ std_limits.h	2001/11/02 22:26:02
@@ -103,11 +103,9 @@
 #ifndef __glibcpp_wchar_t_is_signed
 #define __glibcpp_wchar_t_is_signed true
 #endif
-#ifdef _GLIBCPP_USE_LONG_LONG
 #ifndef __glibcpp_long_long_bits
 #define __glibcpp_long_long_bits 64
 #endif
-#endif
 #ifndef __glibcpp_float_bits
 #define __glibcpp_float_bits 32
 #endif
@@ -133,11 +131,9 @@
 #ifndef __glibcpp_wchar_t_traps
 #define __glibcpp_wchar_t_traps true
 #endif
-#ifdef _GLIBCPP_USE_LONG_LONG
 #ifndef __glibcpp_long_long_traps
 #define __glibcpp_long_long_traps true
 #endif
-#endif
 
 // You should not need to define any macros below this point, unless
 // you have a machine with non-standard bit-widths.
@@ -433,8 +429,6 @@
 // You must define these macros in the configuration file.
 #endif
 
-#ifdef _GLIBCPP_USE_LONG_LONG
-
 // long long
 
 #define __glibcpp_signed_long_long_traps true
@@ -481,8 +475,6 @@
 // You must define these macros in the configuration file.
 #endif
 
-#endif
-
 // wchar_t
 
 #define __glibcpp_wchar_t_traps true
@@ -1645,8 +1637,6 @@ namespace std
 #undef __glibcpp_unsigned_long_digits10
 #undef __glibcpp_unsigned_long_traps  
 
-#ifdef _GLIBCPP_USE_LONG_LONG
-
   template<>
     struct numeric_limits<long long>
     {
@@ -1757,9 +1747,6 @@ namespace std
 #undef __glibcpp_unsigned_long_long_digits
 #undef __glibcpp_unsigned_long_long_digits10
 #undef __glibcpp_unsigned_long_long_traps  
-  
-#endif // _GLIBCPP_USE_LONG_LONG
-  
 
   template<>
     struct numeric_limits<float>
Index: include/bits/type_traits.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/type_traits.h,v
retrieving revision 1.10
diff -u -3 -p -r1.10 type_traits.h
--- type_traits.h	2001/11/02 17:38:11	1.10
+++ type_traits.h	2001/11/02 22:26:02
@@ -208,8 +208,6 @@ template<> struct __type_traits<unsigned
    typedef __true_type    is_POD_type;
 };
 
-#ifdef _GLIBCPP_USE_LONG_LONG
-
 template<> struct __type_traits<long long> {
    typedef __true_type    has_trivial_default_constructor;
    typedef __true_type    has_trivial_copy_constructor;
@@ -226,8 +224,6 @@ template<> struct __type_traits<unsigned
    typedef __true_type    is_POD_type;
 };
 
-#endif /* _GLIBCPP_USE_LONG_LONG */
-
 template<> struct __type_traits<float> {
    typedef __true_type    has_trivial_default_constructor;
    typedef __true_type    has_trivial_copy_constructor;
@@ -313,8 +309,6 @@ template<> struct _Is_integer<unsigned l
   typedef __true_type _Integral;
 };
 
-#ifdef _GLIBCPP_USE_LONG_LONG
-
 template<> struct _Is_integer<long long> {
   typedef __true_type _Integral;
 };
@@ -322,8 +316,6 @@ template<> struct _Is_integer<long long>
 template<> struct _Is_integer<unsigned long long> {
   typedef __true_type _Integral;
 };
-
-#endif /* _GLIBCPP_USE_LONG_LONG */
 
 template<typename _Tp> struct _Is_normal_iterator {
    typedef __false_type _Normal;
Index: include/c_shadow/stdlib.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_shadow/stdlib.h,v
retrieving revision 1.1
diff -u -3 -p -r1.1 stdlib.h
--- stdlib.h	2000/12/21 22:46:25	1.1
+++ stdlib.h	2001/11/02 22:26:02
@@ -47,7 +47,7 @@
   // some names and types with the std:: C++ version.
   using std::div_t;
   using std::ldiv_t;
-#ifdef _GLIBCPP_USE_LONG_LONG
+#ifdef _GLIBCPP_USE_C99
   using std::lldiv_t;
 #endif
 
Index: include/c_shadow/bits/std_cstdlib.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/c_shadow/bits/std_cstdlib.h,v
retrieving revision 1.2
diff -u -3 -p -r1.2 std_cstdlib.h
--- std_cstdlib.h	2001/02/09 14:12:51	1.2
+++ std_cstdlib.h	2001/11/02 22:26:02
@@ -87,7 +87,7 @@ namespace _C_legacy {
 #  undef div
 #  undef labs
 #  undef ldiv
-#ifdef _GLIBCPP_USE_LONG_LONG
+#ifdef _GLIBCPP_USE_C99
 #  undef llabs
 #  undef lldiv
 #endif
@@ -101,7 +101,7 @@ namespace std {
   struct div_t : _C_legacy::_CPP_div_t_capture { };
   struct ldiv_t : _C_legacy::_CPP_ldiv_t_capture { };
 
-#ifdef _GLIBCPP_USE_LONG_LONG
+#ifdef _GLIBCPP_USE_C99
 # ifdef _GLIBCPP_HAVE_LLDIV_T
   struct lldiv_t : _C_legacy::_CPP_lldiv_t_capture { };
 # else
@@ -173,7 +173,7 @@ namespace std {
   div(long __n, long __d)
   { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
 
-#ifdef _GLIBCPP_USE_LONG_LONG
+#ifdef _GLIBCPP_USE_C99
   inline long long 
   llabs(long long __x) { return __x >= 0 ? __x : -__x; }
 
Index: src/concept-inst.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/concept-inst.cc,v
retrieving revision 1.1
diff -u -3 -p -r1.1 concept-inst.cc
--- concept-inst.cc	2001/11/01 15:46:48	1.1
+++ concept-inst.cc	2001/11/02 22:26:02
@@ -94,9 +94,7 @@ namespace __gnu_cxx
 
   _Instantiate(_LessThanComparableConcept<long> );
 
-#ifdef _GLIBCPP_USE_LONG_LONG
   _Instantiate(_LessThanComparableConcept<long long> );
-#endif
 
   _Instantiate(_LessThanComparableConcept<unsigned> );
 
Index: src/limits.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/limits.cc,v
retrieving revision 1.2
diff -u -3 -p -r1.2 limits.cc
--- limits.cc	2001/10/23 21:40:31	1.2
+++ limits.cc	2001/11/02 22:26:02
@@ -305,8 +305,7 @@ namespace std 
   const bool numeric_limits<unsigned long>::tinyness_before;
   const float_round_style numeric_limits<unsigned long>::round_style;
 
-  // XXX: Extensions
-#ifdef _GLIBCPP_USE_LONG_LONG  
+  // NOTA BENE:  long long is an extension
   const bool numeric_limits<long long>::is_specialized;
   const int  numeric_limits<long long>::digits;
   const int  numeric_limits<long long>::digits10;
@@ -352,7 +351,6 @@ namespace std 
   const bool numeric_limits<unsigned long long>::traps;
   const bool numeric_limits<unsigned long long>::tinyness_before;
   const float_round_style numeric_limits<unsigned long long>::round_style;
-#endif // _GLIBCPP_USE_LONG_LONG
 
   // float
   const bool numeric_limits<float>::is_specialized;


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