linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/16] null pointer constants have no special meaning for pointer subtraction
@ 2007-06-24  8:03 Al Viro
  0 siblings, 0 replies; only message in thread
From: Al Viro @ 2007-06-24  8:03 UTC (permalink / raw)
  To: linux-sparse


Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 evaluate.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index febfad2..2510c2b 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -833,16 +833,6 @@ static int is_null_ptr(struct expression *expr)
 	return 1;
 }
 
-static struct symbol *common_ptr_type(struct expression *l, struct expression *r)
-{
-	/* NULL expression? Just return the type of the "other side" */
-	if (is_null_ptr(r))
-		return l->ctype;
-	if (is_null_ptr(l))
-		return r->ctype;
-	return NULL;
-}
-
 /*
  * Ignore differences in "volatile" and "const"ness when
  * subtracting pointers
@@ -868,13 +858,8 @@ static struct symbol *evaluate_ptr_sub(struct expression *expr, struct expressio
 
 	ctype = ltype;
 	typediff = type_difference(ltype, rtype, ~MOD_SIZE, ~MOD_SIZE);
-	if (typediff) {
-		ctype = common_ptr_type(l, r);
-		if (!ctype) {
-			expression_error(expr, "subtraction of different types can't work (%s)", typediff);
-			return NULL;
-		}
-	}
+	if (typediff)
+		expression_error(expr, "subtraction of different types can't work (%s)", typediff);
 	examine_symbol_type(ctype);
 
 	/* Figure out the base type we point to */
-- 
1.5.0-rc2.GIT

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

only message in thread, other threads:[~2007-06-24  8:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-24  8:03 [PATCH 4/16] null pointer constants have no special meaning for pointer subtraction Al Viro

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).