diff options
-rw-r--r-- | libstdc++-v3/include/bits/version.def | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/version.h | 11 | ||||
-rw-r--r-- | libstdc++-v3/include/std/ratio | 56 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc | 6 |
4 files changed, 61 insertions, 20 deletions
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index b500504..80c13d4 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -1583,6 +1583,14 @@ ftms = { }; ftms = { + name = ratio; + values = { + v = 202306; + cxxmin = 26; + }; +}; + +ftms = { name = to_string; values = { v = 202306; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 8b8c70a..5bddb4b 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -1940,6 +1940,17 @@ #undef __glibcxx_want_string_resize_and_overwrite // from version.def line 1586 +#if !defined(__cpp_lib_ratio) +# if (__cplusplus > 202302L) +# define __glibcxx_ratio 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ratio) +# define __cpp_lib_ratio 202306L +# endif +# endif +#endif /* !defined(__cpp_lib_ratio) && defined(__glibcxx_want_ratio) */ +#undef __glibcxx_want_ratio + +// from version.def line 1594 #if !defined(__cpp_lib_to_string) # if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && (__glibcxx_to_chars) # define __glibcxx_to_string 202306L diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio index 1d285bf..c87f54f 100644 --- a/libstdc++-v3/include/std/ratio +++ b/libstdc++-v3/include/std/ratio @@ -39,6 +39,9 @@ #include <type_traits> #include <cstdint> // intmax_t, uintmax_t +#define __glibcxx_want_ratio +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -602,23 +605,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _R1, typename _R2> using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type; - - typedef ratio<1, 1000000000000000000> atto; - typedef ratio<1, 1000000000000000> femto; - typedef ratio<1, 1000000000000> pico; - typedef ratio<1, 1000000000> nano; - typedef ratio<1, 1000000> micro; - typedef ratio<1, 1000> milli; - typedef ratio<1, 100> centi; - typedef ratio<1, 10> deci; - typedef ratio< 10, 1> deca; - typedef ratio< 100, 1> hecto; - typedef ratio< 1000, 1> kilo; - typedef ratio< 1000000, 1> mega; - typedef ratio< 1000000000, 1> giga; - typedef ratio< 1000000000000, 1> tera; - typedef ratio< 1000000000000000, 1> peta; - typedef ratio< 1000000000000000000, 1> exa; +#if __INTMAX_WIDTH__ >= 96 +# if __cpp_lib_ratio >= 202306L +# if __INTMAX_WIDTH__ >= 128 + using quecto = ratio< 1, 1000000000000000000000000000000>; +# endif + using ronto = ratio< 1, 1000000000000000000000000000>; +# endif + using yocto = ratio< 1, 1000000000000000000000000>; + using zepto = ratio< 1, 1000000000000000000000>; +#endif + using atto = ratio< 1, 1000000000000000000>; + using femto = ratio< 1, 1000000000000000>; + using pico = ratio< 1, 1000000000000>; + using nano = ratio< 1, 1000000000>; + using micro = ratio< 1, 1000000>; + using milli = ratio< 1, 1000>; + using centi = ratio< 1, 100>; + using deci = ratio< 1, 10>; + using deca = ratio< 10, 1>; + using hecto = ratio< 100, 1>; + using kilo = ratio< 1000, 1>; + using mega = ratio< 1000000, 1>; + using giga = ratio< 1000000000, 1>; + using tera = ratio< 1000000000000, 1>; + using peta = ratio< 1000000000000000, 1>; + using exa = ratio< 1000000000000000000, 1>; +#if __INTMAX_WIDTH__ >= 96 + using zetta = ratio< 1000000000000000000000, 1>; + using yotta = ratio<1000000000000000000000000, 1>; +# if __cpp_lib_ratio >= 202306L + using ronna = ratio<1000000000000000000000000000, 1>; +# if __INTMAX_WIDTH__ >= 128 + using quetta = ratio<1000000000000000000000000000000, 1>; +# endif +# endif +#endif /// @} group ratio _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc index 2e2a59c..62034e4 100644 --- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc +++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc @@ -43,9 +43,9 @@ test02() // { dg-error "expected initializer" "" { target *-*-* } 35 } // { dg-error "expected initializer" "" { target *-*-* } 37 } // { dg-error "overflow in addition" "" { target *-*-* } 0 } -// { dg-error "overflow in multiplication" "" { target *-*-* } 98 } -// { dg-error "overflow in multiplication" "" { target *-*-* } 100 } -// { dg-error "overflow in multiplication" "" { target *-*-* } 102 } +// { dg-error "overflow in multiplication" "" { target *-*-* } 101 } +// { dg-error "overflow in multiplication" "" { target *-*-* } 103 } +// { dg-error "overflow in multiplication" "" { target *-*-* } 105 } // { dg-error "overflow in constant expression" "" { target *-*-* } 0 } // { dg-error "narrowing conversion" "" { target *-*-* } 0 } // { dg-prune-output "out of range" } |