linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: linux-sparse@vger.kernel.org
Subject: [PATCH 10/18] preparations to ->declarator() cleanup - separate typedef handling
Date: Mon, 09 Mar 2009 07:11:48 +0000	[thread overview]
Message-ID: <E1LgZeO-0000vd-1Y@ZenIV.linux.org.uk> (raw)


Take typedef handling in declaration_specifiers() into separate
branch; kill useless check for qual in case the type we've got
has non-NULL base_type (we'd have already buggered off in that
situation before we get to the check in question).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 parse.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/parse.c b/parse.c
index 1435fde..ba1a52d 100644
--- a/parse.c
+++ b/parse.c
@@ -1105,29 +1105,31 @@ static struct token *declaration_specifiers(struct token *next, struct decl_stat
 		s = lookup_symbol(ident, NS_TYPEDEF);
 		if (!s)
 			break;
-		thistype = s->ctype;
-		mod = thistype.modifiers;
 		if (qual) {
 			if (s->type != SYM_KEYWORD)
 				break;
 			if (!(s->op->type & (KW_ATTRIBUTE | KW_QUALIFIER)))
 				break;
 		}
+		if (s->ctype.modifiers & MOD_USERTYPE) {
+			if (ctx->ctype.base_type)
+				break;
+			if (ctx->ctype.modifiers & MOD_SPECIFIER)
+				break;
+			ctx->ctype.base_type = s->ctype.base_type;
+			apply_ctype(token->pos, &s->ctype, &ctx->ctype);
+			continue;
+		}
+		thistype = s->ctype;
+		mod = thistype.modifiers;
 		if (s->type == SYM_KEYWORD && s->op->declarator) {
 			next = s->op->declarator(next, &thistype);
 			mod = thistype.modifiers;
 		}
 		type = thistype.base_type;
 		if (type) {
-			if (qual)
-				break;
 			if (ctx->ctype.base_type)
 				break;
-			/* User types only mix with qualifiers */
-			if (mod & MOD_USERTYPE) {
-				if (ctx->ctype.modifiers & MOD_SPECIFIER)
-					break;
-			}
 			ctx->ctype.base_type = type;
 		}
 
-- 
1.5.6.5



                 reply	other threads:[~2009-03-09  7:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1LgZeO-0000vd-1Y@ZenIV.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).