summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-07-13 16:42:19 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-07-13 16:42:19 -0700
commit397cfd30aed296e1f3f7c37e0c65ecf558ca8baa (patch)
tree4cf8f6f05c2e88e67dfb369d3cc29458f72f338c
parente7a65459a2f6ce9ea5fd3d0ac413043986c19471 (diff)
Include both option name & argument in invalid argument errors
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 <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/test/x11perf/-/merge_requests/11>
-rw-r--r--x11perf.c2
1 files changed, 1 insertions, 1 deletions
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);
}