On Wed, Jan 03, 2018 at 05:00:41PM -0700, Martin Sebor wrote:
> This is an example where having a solution for bug 78014 would
> be helpful.  I.e., a -Wformat checker to help enforce the use

No, because %zu isn't portable enough for all the hosts we support.

What we could do is define SIZE_T_PRINT_UNSIGNED and similar macros,
to "%zu" on POSIX compliant targets and something else depending on what we
find out during configure (e.g. using templates to find out if size_t
on the host is unsigned {int,long,long long} or something different
(I hope we don't support msp430 as host where size_t is unsigned __int20).

While in theory GCC could handle some PR78014 cases (but only very early
before any folding) for size_t, HOST_WIDE_INT is a define and I don't see
how GCC could argue about portability there.

> of %zu instead of %u or %lu (or an explicit cast from size_t)
> even on targets size_t is unsigned or unsigned long, respectively.

        Jakub

Reply via email to