[5/7] libstdc++: Remove std_ratio_t_tuple

Message ID 20230928174630.4004388-6-tromey@adacore.com
State Unresolved
Headers
Series libstdc++: Use gdb.ValuePrinter in pretty-printers |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Tom Tromey Sept. 28, 2023, 5:46 p.m. UTC
  This removes the std_ratio_t_tuple function from the Python
pretty-printer code.  It is not used.  Apparently the relevant parts
were moved to StdChronoDurationPrinter._ratio at some point in the
past.

libstdc++-v3/ChangeLog:

        * python/libstdcxx/v6/printers.py (std_ratio_t_tuple):
	Remove.
---
 libstdc++-v3/python/libstdcxx/v6/printers.py | 8 --------
 1 file changed, 8 deletions(-)
  

Comments

Jonathan Wakely Sept. 28, 2023, 7:01 p.m. UTC | #1
On Thu, 28 Sept 2023, 18:55 Tom Tromey via Libstdc++, <libstdc++@gcc.gnu.org>
wrote:

> This removes the std_ratio_t_tuple function from the Python
> pretty-printer code.  It is not used.  Apparently the relevant parts
> were moved to StdChronoDurationPrinter._ratio at some point in the
> past.
>

I think I added it at the same time as that printer, rather than moving it
there later. I don't remember if I wanted to replace the _ratio method with
that function, or vice versa, but it looks like I never finished whatever I
meant to do. Either way, we don't need to keep the unused function.

OK, thanks.





> libstdc++-v3/ChangeLog:
>
>         * python/libstdcxx/v6/printers.py (std_ratio_t_tuple):
>         Remove.
> ---
>  libstdc++-v3/python/libstdcxx/v6/printers.py | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py
> b/libstdc++-v3/python/libstdcxx/v6/printers.py
> index 6bf4fe891fd..94ac9232da7 100644
> --- a/libstdc++-v3/python/libstdcxx/v6/printers.py
> +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
> @@ -1985,14 +1985,6 @@ class StdFormatArgsPrinter(printer_base):
>          return "%s with %d arguments" % (typ, size)
>
>
> -def std_ratio_t_tuple(ratio_type):
> -    # TODO use reduced period i.e. duration::period
> -    period = self._val.type.template_argument(1)
> -    num = period.template_argument(0)
> -    den = period.template_argument(1)
> -    return (num, den)
> -
> -
>  class StdChronoDurationPrinter(printer_base):
>      "Print a std::chrono::duration"
>
> --
> 2.40.1
>
>
  

Patch

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 6bf4fe891fd..94ac9232da7 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1985,14 +1985,6 @@  class StdFormatArgsPrinter(printer_base):
         return "%s with %d arguments" % (typ, size)
 
 
-def std_ratio_t_tuple(ratio_type):
-    # TODO use reduced period i.e. duration::period
-    period = self._val.type.template_argument(1)
-    num = period.template_argument(0)
-    den = period.template_argument(1)
-    return (num, den)
-
-
 class StdChronoDurationPrinter(printer_base):
     "Print a std::chrono::duration"