Modernizing pg_bsd_indent's error/warning reporting code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Modernizing pg_bsd_indent's error/warning reporting code
Date: 2026-06-12 16:59:14
Message-ID: 1645041.1781283554@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Buildfarm member greenfly has recently started to warn about
some very hoary code in pg_bsd_indent [1]:

../pgsql/src/tools/pg_bsd_indent/io.c:562:27: warning: diagnostic behavior may be improved by adding the 'format(printf, 2, 3)' attribute to the declaration of 'diag4' [-Wmissing-format-attribute]
562 | fprintf(stdout, msg, a, b);
| ^
../pgsql/src/tools/pg_bsd_indent/io.c:579:24: warning: diagnostic behavior may be improved by adding the 'format(printf, 2, 3)' attribute to the declaration of 'diag3' [-Wmissing-format-attribute]
579 | fprintf(stdout, msg, a);
| ^

This is not an unreasonable suggestion, and presumably more people
will start seeing this as they adopt newer clang versions. (I see
the same on Fedora 44, for instance.) So I think we ought to take
the advice, and while we're at it let's convert this code to use
varargs instead of several duplicative functions. Patch attached.

regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=greenfly&dt=2026-06-11%2018%3A59%3A42&stg=build

Attachment Content-Type Size
v1-0001-Modernize-pg_bsd_indent-s-error-warning-reporting.patch text/x-diff 4.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2026-06-12 17:26:04 Re: Key joins
Previous Message Tom Lane 2026-06-12 16:15:32 Re: typedef struct WindowClause misleading comments