All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add missing checks for Waddress-space
@ 2009-04-23 20:25 Martin Nagy
  2009-04-24 22:53 ` Christopher Li
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Nagy @ 2009-04-23 20:25 UTC (permalink / raw)
  To: linux-sparse


Some of these are missing in evaluate.c. Maybe we should change the
option to not consider address space at all, if unset. It would be much
easier to make attribute_address_space() ignore it.

Signed-off-by: Martin Nagy <nagy.martin@gmail.com>
---
 evaluate.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index 5c3812e..be7a17c 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1149,7 +1149,7 @@ static struct symbol *evaluate_conditional_expression(struct expression *expr)
 			goto Err;
 		}
 		/* OK, it's pointer on pointer */
-		if (ltype->ctype.as != rtype->ctype.as) {
+		if (Waddress_space && ltype->ctype.as != rtype->ctype.as) {
 			typediff = "different address spaces";
 			goto Err;
 		}
@@ -1339,7 +1339,7 @@ static int compatible_assignment_types(struct expression *expr, struct symbol *t
 			 * we do not remove qualifiers from pointed to [C]
 			 * or mix address spaces [sparse].
 			 */
-			if (t->ctype.as != s->ctype.as) {
+			if (Waddress_space && t->ctype.as != s->ctype.as) {
 				typediff = "different address spaces";
 				goto Err;
 			}
-- 
1.6.0.6


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

* Re: [PATCH] Add missing checks for Waddress-space
  2009-04-23 20:25 [PATCH] Add missing checks for Waddress-space Martin Nagy
@ 2009-04-24 22:53 ` Christopher Li
  2009-04-25  7:36   ` Martin Nagy
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Li @ 2009-04-24 22:53 UTC (permalink / raw)
  To: Martin Nagy; +Cc: linux-sparse

On Thu, Apr 23, 2009 at 1:25 PM, Martin Nagy <nagy.martin@gmail.com> wrote:
>
> Some of these are missing in evaluate.c. Maybe we should change the
> option to not consider address space at all, if unset. It would be much
> easier to make attribute_address_space() ignore it.

I think disable it at attribute_address_space() might be better.
Otherwise is_same_type() will still return false for address space difference.
There are too many places to track down the address space comparison.

Chris

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

* Re: [PATCH] Add missing checks for Waddress-space
  2009-04-24 22:53 ` Christopher Li
@ 2009-04-25  7:36   ` Martin Nagy
  2009-04-27  6:08     ` Christopher Li
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Nagy @ 2009-04-25  7:36 UTC (permalink / raw)
  To: Christopher Li; +Cc: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

Christopher Li wrote:
> On Thu, Apr 23, 2009 at 1:25 PM, Martin Nagy <nagy.martin@gmail.com> wrote:
> >
> > Some of these are missing in evaluate.c. Maybe we should change the
> > option to not consider address space at all, if unset. It would be much
> > easier to make attribute_address_space() ignore it.
> 
> I think disable it at attribute_address_space() might be better.
> Otherwise is_same_type() will still return false for address space difference.
> There are too many places to track down the address space comparison.

OK, new patch attached.

Martin

[-- Attachment #2: 0001-Ignore-address-space-if-Waddress_space.patch --]
[-- Type: text/x-patch, Size: 2358 bytes --]

From f05ae87e33092ff9fab9f518887c9dfcb9e32a70 Mon Sep 17 00:00:00 2001
From: Martin Nagy <nagy.martin@gmail.com>
Date: Sat, 25 Apr 2009 06:44:49 +0200
Subject: [PATCH] Ignore address space if !Waddress_space

Remove all previous checks for Waddress_space and add one centralized to
the address_space attribute handler. If user passes the
-Wno-address-space option, we behave as if every pointer had no address
space.

Signed-off-by: Martin Nagy <nagy.martin@gmail.com>
---
 evaluate.c |    8 ++++----
 parse.c    |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index 5c3812e..b63fa36 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -689,7 +689,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
 			/* XXX: we ought to compare sizes */
 			break;
 		case SYM_PTR:
-			if (Waddress_space && as1 != as2)
+			if (as1 != as2)
 				return "different address spaces";
 			/* MOD_SPECIFIER is due to idiocy in parse.c */
 			if ((mod1 ^ mod2) & ~MOD_IGNORE & ~MOD_SPECIFIER)
@@ -706,7 +706,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
 			struct symbol *arg1, *arg2;
 			int i;
 
-			if (Waddress_space && as1 != as2)
+			if (as1 != as2)
 				return "different address spaces";
 			if ((mod1 ^ mod2) & ~MOD_IGNORE & ~MOD_SIGNEDNESS)
 				return "different modifiers";
@@ -745,7 +745,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
 			break;
 		}
 		case SYM_BASETYPE:
-			if (Waddress_space && as1 != as2)
+			if (as1 != as2)
 				return "different address spaces";
 			if (base1 != base2)
 				return "different base types";
@@ -762,7 +762,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
 		t1 = base1;
 		t2 = base2;
 	}
-	if (Waddress_space && as1 != as2)
+	if (as1 != as2)
 		return "different address spaces";
 	if ((mod1 ^ mod2) & ~MOD_IGNORE & ~MOD_SIGNEDNESS)
 		return "different modifiers";
diff --git a/parse.c b/parse.c
index 14ae25d..9662122 100644
--- a/parse.c
+++ b/parse.c
@@ -987,7 +987,7 @@ static struct token *attribute_address_space(struct token *token, struct symbol
 	token = conditional_expression(token, &expr);
 	if (expr) {
 		as = const_expression_value(expr);
-		if (as)
+		if (Waddress_space && as)
 			ctx->ctype.as = as;
 	}
 	token = expect(token, ')', "after address_space attribute");
-- 
1.6.0.6


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

* Re: [PATCH] Add missing checks for Waddress-space
  2009-04-25  7:36   ` Martin Nagy
@ 2009-04-27  6:08     ` Christopher Li
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher Li @ 2009-04-27  6:08 UTC (permalink / raw)
  To: Martin Nagy; +Cc: linux-sparse

On Sat, Apr 25, 2009 at 12:36 AM, Martin Nagy <nagy.martin@gmail.com> wrote:
> OK, new patch attached.

Applied and thanks.

Chris

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

end of thread, other threads:[~2009-04-27  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 20:25 [PATCH] Add missing checks for Waddress-space Martin Nagy
2009-04-24 22:53 ` Christopher Li
2009-04-25  7:36   ` Martin Nagy
2009-04-27  6:08     ` Christopher Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.