Re: [patch] implement generic debug() functions for wide_int's
On 10/18/2017 11:23 PM, Martin Sebor wrote: On 10/18/2017 11:08 AM, Aldy Hernandez wrote: It looks like the generic debug() function for wide_int's is missing. Instead, we have a wi->dump() method. I have implemented debug() for generic wide_int and for widest_int, which should cover the common cases. Anything else, can continue using the ->dump() method templated methods. Do you by any chance also plan to add support to the pretty printer for wide_int (and offset_int)? It would obviate having to convert them to {s,u}hwi. The pretty printer wasn't on my radar. I am mostly concerned in enhancing the debugging experience right now. Perhaps I should put that on my todo list... Aldy
Re: [patch] implement generic debug() functions for wide_int's
On 10/18/2017 06:22 PM, Pedro Alves wrote: On 10/18/2017 06:08 PM, Aldy Hernandez wrote: Also, do we have a blessed way of specifying overloaded functions in ChangeLog's? I couldn't find anything in our GCC coding guidelines or in the GNU coding guidelines. For lack of direction, I'm doing the following: * wide-int.cc (debug) [const wide_int &]: New. (debug) [const wide_int *]: New. (debug) [const widest_int &]: New. (debug) [const widest_int *]: New. It seems appropriate, as that is the GNU way of changelogs for a conditional change to a function ???. Doesn't seem that appropriate to me. Square brackets are used for conditional compilation (#ifdef etc.), but overloads are not that. I'd suggest looking in libstdc++'s ChangeLog for precedents. It's where I looked at when I had the same question for GDB, FWIW. E.g., a very recent libstdc++ commit from Jon had: * include/bits/stl_map.h (map::insert(value_type&&)) (map::insert(const_iterator, value_type&&)): Add overload for rvalues. ...but that's sooo ugly :). Very well. Committed the patch below. Thanks for setting me straight. commit 1a91de5beb16d130bed17f6eeb6b5ca6af454003 (HEAD -> trunk) Author: Aldy HernandezDate: Thu Oct 19 03:49:34 2017 -0400 Update my last ChangeLog entry to properly specify overloaded functions. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a139a824d35..e43c53661e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -17,10 +17,10 @@ 2017-10-18 Aldy Hernandez - * wide-int.cc (debug) [const wide_int &]: New. - (debug) [const wide_int *]: New. - (debug) [const widest_int &]: New. - (debug) [const widest_int *]: New. + * wide-int.cc (debug (const wide_int &)): New. + (debug (const wide_int *)): New. + (debug (const widest_int &)): New. + (debug (const widest_int *)): New.
Re: [patch] implement generic debug() functions for wide_int's
On 10/18/2017 11:08 AM, Aldy Hernandez wrote: It looks like the generic debug() function for wide_int's is missing. Instead, we have a wi->dump() method. I have implemented debug() for generic wide_int and for widest_int, which should cover the common cases. Anything else, can continue using the ->dump() method templated methods. Do you by any chance also plan to add support to the pretty printer for wide_int (and offset_int)? It would obviate having to convert them to {s,u}hwi. Martin
Re: [patch] implement generic debug() functions for wide_int's
On 10/18/2017 06:08 PM, Aldy Hernandez wrote: > Also, do we have a blessed way of specifying overloaded functions in > ChangeLog's? I couldn't find anything in our GCC coding guidelines or > in the GNU coding guidelines. For lack of direction, I'm doing the > following: > > * wide-int.cc (debug) [const wide_int &]: New. > (debug) [const wide_int *]: New. > (debug) [const widest_int &]: New. > (debug) [const widest_int *]: New. > > It seems appropriate, as that is the GNU way of changelogs for a > conditional change to a function ???. Doesn't seem that appropriate to me. Square brackets are used for conditional compilation (#ifdef etc.), but overloads are not that. I'd suggest looking in libstdc++'s ChangeLog for precedents. It's where I looked at when I had the same question for GDB, FWIW. E.g., a very recent libstdc++ commit from Jon had: * include/bits/stl_map.h (map::insert(value_type&&)) (map::insert(const_iterator, value_type&&)): Add overload for rvalues. I.e., simply use the full prototype as function name, since it's really what it is in C++. Thanks, Pedro Alves
Re: [patch] implement generic debug() functions for wide_int's
On Oct 18, 2017, at 10:08 AM, Aldy Hernandezwrote: > > It looks like the generic debug() function for wide_int's is missing. > OK for trunk? Ok.