From 639d282331816915ccddab7a0b52d0996db99317 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 11 Dec 2018 21:26:42 -0500 Subject: [PATCH] Fix: use assignment-suppression for unused sscanf arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This removes the conversion of elements parsed by sscanf() which are not used anyhow and eliminates a warning on x86 builds (%lu used on size_t). Signed-off-by: Jérémie Galarneau --- src/bin/lttng/commands/enable_events.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index f7c5553da..b4e6320c5 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -305,12 +305,10 @@ end: */ static int warn_userspace_probe_syntax(const char *symbol) { - unsigned long addr = 0; - size_t offset = 0; int ret; /* Check if the symbol field is an hex address. */ - ret = sscanf(symbol, "0x%lx", &addr); + ret = sscanf(symbol, "0x%*x"); if (ret > 0) { /* If there is a match, print a warning and return an error. */ ERR("Userspace probe on address not supported yet."); @@ -319,7 +317,7 @@ static int warn_userspace_probe_syntax(const char *symbol) } /* Check if the symbol field is an decimal address. */ - ret = sscanf(symbol, "%lu", &addr); + ret = sscanf(symbol, "%*u"); if (ret > 0) { /* If there is a match, print a warning and return an error. */ ERR("Userspace probe on address not supported yet."); @@ -328,7 +326,7 @@ static int warn_userspace_probe_syntax(const char *symbol) } /* Check if the symbol field is symbol+hex_offset. */ - ret = sscanf(symbol, "%*[^+]+0x%lx", &offset); + ret = sscanf(symbol, "%*[^+]+0x%*x"); if (ret > 0) { /* If there is a match, print a warning and return an error. */ ERR("Userspace probe on symbol+offset not supported yet."); @@ -337,7 +335,7 @@ static int warn_userspace_probe_syntax(const char *symbol) } /* Check if the symbol field is symbol+decimal_offset. */ - ret = sscanf(symbol, "%*[^+]+%lu", &offset); + ret = sscanf(symbol, "%*[^+]+%*u"); if (ret > 0) { /* If there is a match, print a warning and return an error. */ ERR("Userspace probe on symbol+offset not supported yet."); -- 2.34.1