Stephen Webb's staging headers patch

David Edelsohn dje@watson.ibm.com
Sat Jul 21 21:12:00 GMT 2001


David> That would avoid multilibbed target includes as well.

Ben> Excellent.

	How's this change?  I think it it should be correct for the RH
16-bit targets as well, but I'm not sure how GCC C types are defined for
16-bit targets.  This probably is not correct for targets with unusual
word sizes, but it's better than the current situation.

Thanks, David


	* include/bits/limits_generic.h (int): Set digits and digits10
	appropriately for word size.
	(unsigned int,long,unsigned long): Likewise.

Index: limits_generic.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/limits_generic.h,v
retrieving revision 1.4
diff -c -p -r1.4 limits_generic.h
*** limits_generic.h	2001/07/11 19:35:48	1.4
--- limits_generic.h	2001/07/22 03:59:42
*************** namespace std {
*** 469,476 ****
--- 469,481 ----
          static int max() throw()
          { return INT_MAX; }
  
+ #if INT_MAX > 32767
          static const int digits = 31;
          static const int digits10 = 9;
+ #else
+         static const int digits = 15;
+         static const int digits10 = 4;
+ #endif
          static const bool is_signed = true;
          static const bool is_integer = true;
          static const bool is_exact = true;
*************** namespace std {
*** 517,524 ****
--- 522,534 ----
          static unsigned int max() throw()
          { return UINT_MAX; }
  
+ #if INT_MAX > 32767
          static const int digits = 32;
          static const int digits10 = 9;
+ #else
+         static const int digits = 16;
+         static const int digits10 = 4;
+ #endif
          static const bool is_signed = false;
          static const bool is_integer = true;
          static const bool is_exact = true;
*************** namespace std {
*** 565,572 ****
--- 575,590 ----
          static long max() throw()
          { return LONG_MAX; }
  
+ #if LONG_MAX > 2147483647
+         static const int digits = 63;
+         static const int digits10 = 18;
+ #elif LONG_MAX > 32767
          static const int digits = 31;
          static const int digits10 = 9;
+ #else
+         static const int digits = 15;
+         static const int digits10 = 4;
+ #endif
          static const bool is_signed = true;
          static const bool is_integer = true;
          static const bool is_exact = true;
*************** namespace std {
*** 613,620 ****
--- 631,646 ----
          static unsigned long max() throw()
          { return ULONG_MAX; }
  
+ #if LONG_MAX > 2147483647
+         static const int digits = 64;
+         static const int digits10 = 19;
+ #elif LONG_MAX > 32767
          static const int digits = 32;
          static const int digits10 = 9;
+ #else
+         static const int digits = 16;
+         static const int digits10 = 4;
+ #endif
          static const bool is_signed = false;
          static const bool is_integer = true;
          static const bool is_exact = true;



More information about the Libstdc++ mailing list