__attribute__: trace2_region_enter_printf() is like "printf"

The last part of the parameter list the function takes is like parameters to printf. Mark it as such. An existing call that formats a value of type size_t using "%d" was found by the compiler with the help with this annotation; fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jun 8, 2024 at 11:37 UTC 89e78c7cdad1ac70d16c0ceb79b3ff95dfadd2bb
2 files changed +3 -1
run-command.c
+2 -1
@@ -1753,7 +1753,8 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
1753
1754 if (do_trace2)
1755 trace2_region_enter_printf(tr2_category, tr2_label, NULL,
1756 - "max:%d", opts->processes);
1756 + "max:%"PRIuMAX,
1757 + (uintmax_t)opts->processes);
1758
1759 pp_init(&pp, opts, &pp_sig);
1760 while (1) {
trace2.h
+1
@@ -390,6 +390,7 @@ void trace2_region_enter_printf_va_fl(const char *file, int line,
390 trace2_region_enter_printf_va_fl(__FILE__, __LINE__, (category), \
391 (label), (repo), (fmt), (ap))
392
393 +__attribute__((format (printf, 6, 7)))
394 void trace2_region_enter_printf_fl(const char *file, int line,
395 const char *category, const char *label,
396 const struct repository *repo,