linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] option: accept 'sparse -U ...'
@ 2020-07-22 21:28 Luc Van Oostenryck
  0 siblings, 0 replies; only message in thread
From: Luc Van Oostenryck @ 2020-07-22 21:28 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

The '-D' flag was fixed to accept whitespace before the argument
but the '-U' flag wasn't. So, fix this now.

Fixes: 7f1011b311e9329f53d73f88de495ea64071eb77
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 options.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/options.c b/options.c
index a2e15bb75c0d..f7e81b84d749 100644
--- a/options.c
+++ b/options.c
@@ -782,6 +782,12 @@ static char **handle_switch_s(const char *arg, char **next)
 static char **handle_switch_U(char *arg, char **next)
 {
 	const char *name = arg + 1;
+
+	if (*name == '\0') {
+		name = *++next;
+		if (!name)
+			die("argument to `-U' is missing");
+	}
 	add_pre_buffer("#undef %s\n", name);
 	return next;
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-22 21:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 21:28 [PATCH] option: accept 'sparse -U ...' Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).