This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 5/5] Formatted printing for dump_* in the middle-end


On Tue, 31 Jul 2018, David Malcolm wrote:

> I didn't exhaustively check every callsite to the changed calls; I'm
> assuming that -Wformat during bootstrap has effectively checked that
> for me.  Though now I think about it, I note that we use
> HOST_WIDE_INT_PRINT_DEC in many places: is this guaranteed to be a
> valid input to pp_format on all of our configurations?

HOST_WIDE_INT_PRINT_DEC should not be considered safe with pp_format 
(although since r197049 may have effectively stopped using %I64 on MinGW 
hosts, I'm not sure if there are current cases where it won't work).  
Rather, it is the job of pp_format to map the 'w' length specifier to 
HOST_WIDE_INT_PRINT_DEC etc.

I think it clearly makes for cleaner code to limit use of 
HOST_WIDE_INT_PRINT_* to as few places as possible and to prefer use of 
internal printf-like functions that accept formats such as %wd where 
possible.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]