From patchwork Sat Apr 25 07:36:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Nagy X-Patchwork-Id: 19932 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3P7aS0X028576 for ; Sat, 25 Apr 2009 07:36:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751301AbZDYHg1 (ORCPT ); Sat, 25 Apr 2009 03:36:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751992AbZDYHg1 (ORCPT ); Sat, 25 Apr 2009 03:36:27 -0400 Received: from mail-ew0-f176.google.com ([209.85.219.176]:44792 "EHLO mail-ew0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751301AbZDYHg0 (ORCPT ); Sat, 25 Apr 2009 03:36:26 -0400 Received: by ewy24 with SMTP id 24so1344430ewy.37 for ; Sat, 25 Apr 2009 00:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=Y5fX0nXU2fr3gHbMlIFiZziH5pzdx0eW9+DC3fQ+d8o=; b=Fr3ULHhyQOhNmSbPomjSffU0PItiFM+ZOFeRAoT8BXEpmnNPGhw6x6raYxOFdVhd3j oXmpPsK/uy0D9QjCnc+T8rQq5GAeqwEB7/8AoTUn9m5VbsvT875QI4FfS9EMGqaTTAl+ NqmuEIIgbpKuKnllrytURoHWneF2IvRT3Svp8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=ivAtxmtz2JyYMuUnJaL9Li+JJWsiwH3JqAwz2Nm2lnwzqExWxnVxOzvuno8sumijcE ggTsQC+9O+uRE1FwaBVOw3HptogxqANr3AHv8meqmXgSvya1sGlIxRxfztqsf/+iLQkB 9RBZuv3MOrLKiDhknRnQwob4ywGLZ43/opNL0= Received: by 10.211.196.13 with SMTP id y13mr2263215ebp.76.1240644985067; Sat, 25 Apr 2009 00:36:25 -0700 (PDT) Received: from notas (r2ah146.net.upc.cz [62.245.97.146]) by mx.google.com with ESMTPS id 5sm2903284eyh.20.2009.04.25.00.36.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 25 Apr 2009 00:36:24 -0700 (PDT) Date: Sat, 25 Apr 2009 09:36:16 +0200 From: Martin Nagy To: Christopher Li Cc: linux-sparse@vger.kernel.org Subject: Re: [PATCH] Add missing checks for Waddress-space Message-ID: <20090425093616.3edbb9b5@notas> In-Reply-To: <70318cbf0904241553h58e18921q35c6001ad51cc662@mail.gmail.com> References: <20090423222519.48191d61@notas> <70318cbf0904241553h58e18921q35c6001ad51cc662@mail.gmail.com> X-Mailer: Claws Mail 3.7.0 (GTK+ 2.12.12; i386-redhat-linux-gnu) Mime-Version: 1.0 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Christopher Li wrote: > On Thu, Apr 23, 2009 at 1:25 PM, Martin Nagy 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 From f05ae87e33092ff9fab9f518887c9dfcb9e32a70 Mon Sep 17 00:00:00 2001 From: Martin Nagy 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 --- 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