trunk/fixincludes/fixincl.c:162]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'size_t {aka unsigned long}'. Source code is tSCC zFmt[] = "\ Processed %5d files containing %d bytes \n\ Applying %5d fixes to %d files\n\ Altering %5d of them\n"; fprintf (stderr, zFmt, process_ct, ttl_data_size, apply_ct, fixed_ct, altered_ct); Suggest use %lu for size_t, not %d.
I wonder why GCC -Wformat does not catch this, since "static const char" literals contents should be visible as formatting strings. In this case, it doesn't even make sense to use a separate variable.
(In reply to Manuel López-Ibáñez from comment #1) > I wonder why GCC -Wformat does not catch this, since "static const char" > literals contents should be visible as formatting strings. In this case, it > doesn't even make sense to use a separate variable. There is a much simpler explanation for this. The compiler only sees code that gets through the preprocessor. The code in question has #ifdef DO_STATS around it. Still worth fixing, in my view. 2e9 bytes isn't a lot of source code these days.
(In reply to David Binderman from comment #2) > The compiler only sees code that gets through the preprocessor. > Still worth fixing, in my view. 2e9 bytes isn't a lot of source code these > days. In that case, I would say "not really". If you have any time to contribute to GCC, there are plenty more important things that you could do with your time. But there is no harm in keeping it open in case someone disagrees and decides to fix it.
(In reply to David Binderman from comment #2) > (In reply to Manuel López-Ibáñez from comment #1) > > I wonder why GCC -Wformat does not catch this, since "static const char" > > literals contents should be visible as formatting strings. In this case, it > > doesn't even make sense to use a separate variable. > > There is a much simpler explanation for this. > > The compiler only sees code that gets through the preprocessor. > > The code in question has > > #ifdef DO_STATS > > around it. > > Still worth fixing, in my view. 2e9 bytes isn't a lot of source code these > days. Where is DO_STATS supposed to be defined?
Patch posted to https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01511.html
svn blame says Paolo Bonzini wrote this code; cc-ing him
(In reply to Jonathan Wakely from comment #5) > Patch posted to https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01511.html I thought the format code for size_t was %zu?
(In reply to Eric Gallager from comment #7) > (In reply to Jonathan Wakely from comment #5) > > Patch posted to https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01511.html > > I thought the format code for size_t was %zu? ...actually I guess we can't actually use that here; see discussion in bug 78014...