All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Alexey Gladkov <gladkov.alexey@gmail.com>, linux-sparse@vger.kernel.org
Subject: [PATCH] dissect: kill return_type
Date: Fri, 7 Feb 2020 11:32:13 +0100	[thread overview]
Message-ID: <20200207103213.GA17010@redhat.com> (raw)

Now that we have dissect_ctx do_statement(STMT_RETURN) can use
base_type(dissect_ctx->ctype.base_type) instead.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 dissect.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dissect.c b/dissect.c
index b48cd85..85489a2 100644
--- a/dissect.c
+++ b/dissect.c
@@ -54,7 +54,6 @@ typedef unsigned usage_t;
 struct symbol *dissect_ctx;
 
 static struct reporter *reporter;
-static struct symbol *return_type;
 
 static void do_sym_list(struct symbol_list *list);
 
@@ -489,8 +488,10 @@ static struct symbol *do_statement(usage_t mode, struct statement *stmt)
 	break; case STMT_EXPRESSION:
 		ret = do_expression(mode, stmt->expression);
 
-	break; case STMT_RETURN:
-		do_expression(u_lval(return_type), stmt->expression);
+	break; case STMT_RETURN: {
+		struct symbol *type = dissect_ctx->ctype.base_type;
+		do_expression(u_lval(base_type(type)), stmt->expression);
+	}
 
 	break; case STMT_ASM:
 		do_expression(U_R_VAL, stmt->asm_string);
@@ -617,11 +618,9 @@ static inline struct symbol *do_symbol(struct symbol *sym)
 				show_ident(sym->ident));
 
 		dissect_ctx = sym;
-		return_type = base_type(type);
 		do_sym_list(type->arguments);
 		do_statement(U_VOID, stmt);
 		dissect_ctx = dctx;
-		return_type = NULL;
 	}
 
 	return type;
-- 
2.5.0

                 reply	other threads:[~2020-02-07 10:32 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=20200207103213.GA17010@redhat.com \
    --to=oleg@redhat.com \
    --cc=gladkov.alexey@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    /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 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.