Modernize pg_bsd_indent's error/warning reporting code.

Late-model clang complains that these functions should be labeled
with "format(printf, 2, 3)", and it's right.  But let's go a bit
further and also make use of varargs, to remove duplication and
allow these functions to be used with non-integer input values.

Since no good deed goes unpunished, I had to also adjust a couple
of call sites.  They weren't wrong as-is, since the size_t-sized
arguments were coerced to int on the way into diag3().  But
without that, we have to adjust the format strings.

The point of this is to suppress compiler warnings, so back-patch
into branches containing pg_bsd_indent, even though there's no
functional change.

Author: Tom Lane <[email protected]>
Reviewed-by: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 16

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ca6969629d8526706ba0368b0063ddca86ed1f3e

Modified Files
--------------
src/tools/pg_bsd_indent/indent.c |  4 ++--
src/tools/pg_bsd_indent/indent.h |  9 ++++++---
src/tools/pg_bsd_indent/io.c     | 43 ++++++----------------------------------
3 files changed, 14 insertions(+), 42 deletions(-)

Reply via email to