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
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6603e81e69e9b7378e2581f436119a7c6cb94cf9

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