V3 PATCH: Make numeric_limits<>::is_modulo == true by default
Gabriel Dos Reis
gdr@codesourcery.com
Tue Dec 25 06:01:00 GMT 2001
Benjamin, in private mail, pointed out this thinko.
For plateforms known to have fancier behaviour when the result of the
addition of two integers is out of bounds, maintainers should
#define __glibcpp_<integer-type>_is_modulo false
in the appropriate os_defines.h.
Bootstrapped and tested on x686-pc-linux-gnu. Committed on 3.1 mainline.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com
http://www.codesourcery.com/gcc-compile.shtml
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/ChangeLog,v
retrieving revision 1.919
diff -p -r1.919 ChangeLog
*** ChangeLog 2001/12/24 01:45:27 1.919
--- ChangeLog 2001/12/25 13:51:21
***************
*** 1,3 ****
--- 1,10 ----
+ 2001-12-25 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * include/bits/std_limits.h (__glibcpp_xxx_is_modulo): New
+ macros for signed types; default value is true.
+ (numeric_limits<>::is_modulo): Get value from corresponding
+ __glibcpp_xxx_is_modulo macro.
+
Sun Dec 23 18:47:24 2001 Jeffrey A Law (law@redhat.com)
* config/os/hpux/bits/os_defines.h: Do not include <_sys/inttypes.h>.
Index: include/bits/std_limits.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/std_limits.h,v
retrieving revision 1.13
diff -p -r1.13 std_limits.h
*** std_limits.h 2001/12/18 06:57:27 1.13
--- std_limits.h 2001/12/25 13:51:24
***************
*** 245,250 ****
--- 245,256 ----
#define __glibcpp_plain_char_traps true
#define __glibcpp_signed_char_traps true
#define __glibcpp_unsigned_char_traps true
+ #ifndef __glibcpp_char_is_modulo
+ #define __glibcpp_char_is_modulo true
+ #endif
+ #ifndef __glibcpp_signed_char_is_modulo
+ #define __glibcpp_signed_char_is_modulo true
+ #endif
#if __glibcpp_char_bits == 8
#define __glibcpp_signed_char_min __glibcpp_s8_min
#define __glibcpp_signed_char_max __glibcpp_s8_max
***************
*** 301,306 ****
--- 307,315 ----
#define __glibcpp_signed_short_traps true
#define __glibcpp_unsigned_short_traps true
+ #ifndef __glibcpp_signed_short_is_modulo
+ #define __glibcpp_signed_short_is_modulo true
+ #endif
#if __glibcpp_short_bits == 8
#define __glibcpp_signed_short_min __glibcpp_s8_min
#define __glibcpp_signed_short_max __glibcpp_s8_max
***************
*** 345,350 ****
--- 354,362 ----
#define __glibcpp_signed_int_traps true
#define __glibcpp_unsigned_int_traps true
+ #ifndef __glibcpp_signed_int_is_modulo
+ #define __glibcpp_signed_int_is_modulo true
+ #endif
#if __glibcpp_int_bits == 8
#define __glibcpp_signed_int_min __glibcpp_s8_min
#define __glibcpp_signed_int_max __glibcpp_s8_max
***************
*** 389,394 ****
--- 401,409 ----
#define __glibcpp_signed_long_traps true
#define __glibcpp_unsigned_long_traps true
+ #ifndef __glibcpp_signed_long_is_modulo
+ #define __glibcpp_signed_long_is_modulo true
+ #endif
#if __glibcpp_long_bits == 8
#define __glibcpp_signed_long_min __glibcpp_s8_min
#define __glibcpp_signed_long_max __glibcpp_s8_max
***************
*** 433,438 ****
--- 448,456 ----
#define __glibcpp_signed_long_long_traps true
#define __glibcpp_signed_long_long_traps true
+ #ifndef __glibcpp_signed_long_long_is_modulo
+ #define __glibcpp_signed_long_long_is_modulo true
+ #endif
#if __glibcpp_long_long_bits == 8
#define __glibcpp_signed_long_long_min __glibcpp_s8_min
#define __glibcpp_signed_long_long_max __glibcpp_s8_max
***************
*** 478,483 ****
--- 496,504 ----
// wchar_t
#define __glibcpp_wchar_t_traps true
+ #ifndef __glibcpp_wchar_t_is_modulo
+ #define __glibcpp_wchar_t_is_modulo true
+ #endif
#if __glibcpp_wchar_t_is_signed
#if __glibcpp_wchar_t_bits == 8
#define __glibcpp_wchar_t_min __glibcpp_s8_min
*************** namespace std
*** 1121,1129 ****
static const bool is_iec559 = false;
static const bool is_bounded = true;
! static const bool is_modulo = false;
! static const bool traps = __glibcpp_signed_char_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
--- 1142,1150 ----
static const bool is_iec559 = false;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_char_is_modulo;
! static const bool traps = __glibcpp_char_traps;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
*************** namespace std
*** 1133,1141 ****
--- 1154,1164 ----
#undef __glibcpp_char_digits
#undef __glibcpp_char_digits10
#undef __glibcpp_char_is_signed
+ #undef __glibcpp_char_is_modulo
#undef __glibcpp_char_traps
+
template<>
struct numeric_limits<signed char>
{
*************** namespace std
*** 1179,1185 ****
static const bool is_iec559 = false;
static const bool is_bounded = true;
! static const bool is_modulo = false;
static const bool traps = __glibcpp_signed_char_traps;
static const bool tinyness_before = false;
--- 1202,1208 ----
static const bool is_iec559 = false;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_signed_char_is_modulo;
static const bool traps = __glibcpp_signed_char_traps;
static const bool tinyness_before = false;
*************** namespace std
*** 1190,1195 ****
--- 1213,1219 ----
#undef __glibcpp_signed_char_max
#undef __glibcpp_signed_char_digits
#undef __glibcpp_signed_char_digits10
+ #undef __glibcpp_signed_char_is_modulo
#undef __glibcpp_signed_char_traps
template<>
*************** namespace std
*** 1290,1296 ****
static const bool is_iec559 = false;
static const bool is_bounded = true;
! static const bool is_modulo = false;
static const bool traps = __glibcpp_wchar_t_traps;
static const bool tinyness_before = false;
--- 1314,1320 ----
static const bool is_iec559 = false;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_wchar_t_is_modulo;
static const bool traps = __glibcpp_wchar_t_traps;
static const bool tinyness_before = false;
*************** namespace std
*** 1302,1307 ****
--- 1326,1332 ----
#undef __glibcpp_wchar_t_digits
#undef __glibcpp_wchar_t_digits10
#undef __glibcpp_wchar_t_is_signed
+ #undef __glibcpp_wchar_t_is_modulo
#undef __glibcpp_wchar_t_traps
template<>
*************** namespace std
*** 1347,1353 ****
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = false;
static const bool traps = __glibcpp_signed_short_traps;
static const bool tinyness_before = false;
--- 1372,1378 ----
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_signed_short_is_modulo;
static const bool traps = __glibcpp_signed_short_traps;
static const bool tinyness_before = false;
*************** namespace std
*** 1358,1363 ****
--- 1383,1389 ----
#undef __glibcpp_signed_short_max
#undef __glibcpp_signed_short_digits
#undef __glibcpp_signed_short_digits10
+ #undef __glibcpp_signed_short_is_modulo
#undef __glibcpp_signed_short_traps
template<>
*************** namespace std
*** 1458,1464 ****
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = false;
static const bool traps = __glibcpp_signed_int_traps;
static const bool tinyness_before = false;
--- 1484,1490 ----
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_signed_int_is_modulo;
static const bool traps = __glibcpp_signed_int_traps;
static const bool tinyness_before = false;
*************** namespace std
*** 1469,1474 ****
--- 1495,1501 ----
#undef __glibcpp_signed_int_max
#undef __glibcpp_signed_int_digits
#undef __glibcpp_signed_int_digits10
+ #undef __glibcpp_signed_int_is_modulo
#undef __glibcpp_signed_int_traps
template<>
*************** namespace std
*** 1569,1575 ****
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = false;
static const bool traps = __glibcpp_signed_long_traps;
static const bool tinyness_before = false;
--- 1596,1602 ----
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_signed_long_is_modulo;
static const bool traps = __glibcpp_signed_long_traps;
static const bool tinyness_before = false;
*************** namespace std
*** 1580,1585 ****
--- 1607,1613 ----
#undef __glibcpp_signed_long_max
#undef __glibcpp_signed_long_digits
#undef __glibcpp_signed_long_digits10
+ #undef __glibcpp_signed_long_is_modulo
#undef __glibcpp_signed_long_traps
template<>
*************** namespace std
*** 1680,1686 ****
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = false;
static const bool traps = __glibcpp_signed_long_long_traps;
static const bool tinyness_before = false;
--- 1708,1714 ----
static const bool is_iec559 = true;
static const bool is_bounded = true;
! static const bool is_modulo = __glibcpp_signed_long_long_is_modulo;
static const bool traps = __glibcpp_signed_long_long_traps;
static const bool tinyness_before = false;
*************** namespace std
*** 1691,1696 ****
--- 1719,1725 ----
#undef __glibcpp_signed_long_long_max
#undef __glibcpp_signed_long_long_digits
#undef __glibcpp_signed_long_long_digits10
+ #undef __glibcpp_signed_long_long_is_modulo
#undef __glibcpp_signed_long_long_traps
template<>
More information about the Libstdc++
mailing list