Skip to contentSkip to conversation

check for whitespace before object-like macro body

PATCH New Al Viro 1 participant 1 message May 25, 2007 Sparse checker

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 check for whitespace before object-like macro body

6.10.3(3) requires a whitespace between object-like macro and its replacement list.

---
 pre-process.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
pre-process.c +10 -5
index 2b9cecc..8fca383 100644
@@ -1089,11 +1089,16 @@ static int do_handle_define(struct stream *stream, struct token **line, struct t
 
 	arglist = NULL;
 	expansion = left->next;
-	if (!expansion->pos.whitespace && match_op(expansion, '(')) {
-		arglist = expansion;
-		expansion = parse_arguments(expansion);
-		if (!expansion)
-			return 1;
+	if (!expansion->pos.whitespace) {
+		if (match_op(expansion, '(')) {
+			arglist = expansion;
+			expansion = parse_arguments(expansion);
+			if (!expansion)
+				return 1;
+		} else if (!eof_token(expansion)) {
+			warning(expansion->pos,
+				"no whitespace before object-like macro body");
+		}
 	}
 
 	expansion = parse_expansion(expansion, arglist, name);
Signature · 1 line
1.5.0-rc2.GIT