public inbox for smatch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 05/18] sparse: correctly handle "-D foo" and "-U foo". The former is from sparse upstream, but they didn't fix the latter for some reason.
@ 2018-11-22 12:08 John Levon
  2018-11-25 21:29 ` Luc Van Oostenryck
  0 siblings, 1 reply; 9+ messages in thread
From: John Levon @ 2018-11-22 12:08 UTC (permalink / raw)


Signed-off-by: John Levon <levon@movementarian.org>
---
 lib.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib.c b/lib.c
index f20e0885..d7cd8cbc 100644
--- a/lib.c
+++ b/lib.c
@@ -325,15 +325,19 @@ static char **handle_switch_D(char *arg, char **next)
 	const char *name = arg + 1;
 	const char *value = "1";
 
-	if (!*name || isspace((unsigned char)*name))
-		die("argument to `-D' is missing");
+	if (!*name) {
+		arg = *++next;
+		if (!arg)
+			die("argument to `-D' is missing");
+		name = arg;
+	}
 
-	for (;;) {
+	for (;;arg++) {
 		char c;
-		c = *++arg;
+		c = *arg;
 		if (!c)
 			break;
-		if (isspace((unsigned char)c) || c == '=') {
+		if (c == '=') {
 			*arg = '\0';
 			value = arg + 1;
 			break;
@@ -685,6 +689,8 @@ static void handle_switch_v_finalize(void)
 static char **handle_switch_U(char *arg, char **next)
 {
 	const char *name = arg + 1;
+	if (*name == '\0')
+		name = *++next;
 	add_pre_buffer ("#undef %s\n", name);
 	return next;
 }
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-11-29 21:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22 12:08 [PATCH 05/18] sparse: correctly handle "-D foo" and "-U foo". The former is from sparse upstream, but they didn't fix the latter for some reason John Levon
2018-11-25 21:29 ` Luc Van Oostenryck
2018-11-25 23:29   ` John Levon
2018-11-26  0:27     ` Luc Van Oostenryck
2018-11-26  7:49       ` Dan Carpenter
2018-11-29 10:03         ` Sync smatch with sparse? Luc Van Oostenryck
2018-11-29 10:09           ` John Levon
2018-11-26  8:44       ` [PATCH 05/18] sparse: correctly handle "-D foo" and "-U foo". The former is from sparse upstream, but they didn't fix the latter for some reason John Levon
2018-11-26  9:18         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox