From 397cfd30aed296e1f3f7c37e0c65ecf558ca8baa Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 13 Jul 2024 16:42:19 -0700 Subject: Include both option name & argument in invalid argument errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found by gcc 14.1: x11perf.c: In function ‘invalid_arg’: x11perf.c:339:21: warning: too many arguments for format [-Wformat-extra-args] 339 | fprintf(stderr, "Error: invalid argument to %s\n", arg, option); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: e7a6545 ("When users give invalid arguments, tell them what they did wrong") Signed-off-by: Alan Coopersmith Part-of: --- x11perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x11perf.c b/x11perf.c index eacea0d..e20de88 100644 --- a/x11perf.c +++ b/x11perf.c @@ -336,7 +336,7 @@ missing_arg(const char *option) _X_NORETURN _X_COLD static void invalid_arg( const char *arg, const char *option) { - fprintf(stderr, "Error: invalid argument to %s\n", arg, option); + fprintf(stderr, "Error: invalid argument '%s' to %s\n", arg, option); usage(USAGE_OPTIONS, EXIT_FAILURE); } -- cgit v1.2.3