Powered by Linux
[PATCH 01/12] sparse: correctly handle "-D foo" and "-U foo" — Semantic Matching Tool

[PATCH 01/12] sparse: correctly handle "-D foo" and "-U foo"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The former fix is from sparse upstream, the -U change is by me.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
Signed-off-by: John Levon <levon@xxxxxxxxxxxxxxxxx>
---
 lib.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib.c b/lib.c
index b03229c..0f7ad2a 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;
@@ -680,6 +684,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;
 }
-- 
1.8.3.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux