On 21 September 2015 at 09:24, Richard Biener <rguent...@suse.de> wrote: > On Sun, 20 Sep 2015, Manuel López-Ibáñez wrote: > >> In do_warn_aggressive_loop_optimizations, we convert to a tree just to print >> a >> widest_int. Apart from overly complicated, this results in printing '3u' >> instead of just '3'. >> >> Unfortunately, adding a printf-like conversion specifier would require making >> pretty-print.c link with wide-int.cc, which will include a lot of new >> dependencies into several other programs (gcov-tool for example). It would be >> possible to add the conversion specifier to every FE pretty-printer, but this >> still would require updating c-format.c, which is far from trivial. A simpler >> approach is to convert to a string rather than to a tree. > > I'd add the pretty printer overloads to wide-int-print.[ch], but yes > it would require a change in c-format.c.
That is not enough, some conversion specifier parser needs to handle the new codes. The one in pretty-print.c is used all over the place and adding a dependency on wide-int.cc will bring gmp and other stuff that is currently not used (nor linked with) various helper programs. If wide-int is only printed in the middle-end, perhaps it is sufficient to add it to default_tree_printer. Otherwise, it needs to be added to every FE. This is not difficult just tedious. The difficult part is the c-format.c changes (I wish someone would fix https://gcc.gnu.org/PR47781 so we can use a simpler syntax to define our custom specifiers; in addition to the positive synergies it will bring with other GNU projects that use custom specifiers and wish to use -Wformat). >> OK? > > Ok. Let's remember this case and if more of these pop up try working > on a "proper" solution. Sure, I added my WIP patch to the PR, but I don't plan to keep working on it. Cheers, Manuel.