All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH v2 2/3] let identical symbols share their evaluate/expand methods
Date: Sun, 12 Feb 2017 16:10:59 +0100	[thread overview]
Message-ID: <20170212151100.15868-3-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170212151100.15868-1-luc.vanoostenryck@gmail.com>

So far, builtin functions which had some evaluate/expand method
couldn't also have a prototype because the declaration of the
prototype and the definition of the builtin with its method would
each have their own symbol and only one of them will be seen, the
last one, the one for the prototype.
This also meant that the evaluate/expand methods had to take care
to set the correct types for they argumenst & results, which is fine
for some generic builtins like __builtin_constant_p() but much less
practical for the ones like __builtin_bswap{16,32,64}().

Fix this by letting symbols with same name share their methods.

Originally-by: Christopher Li <sparse@chrisli.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/parse.c b/parse.c
index b65a6ebce..a4a126720 100644
--- a/parse.c
+++ b/parse.c
@@ -2879,8 +2879,10 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis
 			}
 		}
 		check_declaration(decl);
-		if (decl->same_symbol)
+		if (decl->same_symbol) {
 			decl->definition = decl->same_symbol->definition;
+			decl->op = decl->same_symbol->op;
+		}
 
 		if (!match_op(token, ','))
 			break;
-- 
2.11.0


  parent reply	other threads:[~2017-02-12 15:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 21:37 [PATCH 0/3] builtins expansion Luc Van Oostenryck
2017-01-23 21:37 ` [PATCH 1/3] move evaluation & expansion of builtins in a separate file Luc Van Oostenryck
2017-01-23 21:37 ` [PATCH 2/3] allow builtins to have prototype and evaluate/expand methods Luc Van Oostenryck
2017-02-07 19:49   ` Chris Li
2017-02-07 20:12     ` Luc Van Oostenryck
2017-02-07 20:26       ` Chris Li
2017-02-07 20:32       ` Christopher Li
2017-02-07 21:34         ` Luc Van Oostenryck
2017-02-07 22:19           ` Christopher Li
2017-02-12 15:03     ` Luc Van Oostenryck
2017-02-12 15:10       ` [PATCH v2 0/3] builtins expansion Luc Van Oostenryck
2017-02-12 15:10         ` [PATCH v2 1/3] move evaluation & expansion of builtins in a separate file Luc Van Oostenryck
2017-02-12 15:10         ` Luc Van Oostenryck [this message]
2017-02-12 15:11         ` [PATCH v2 3/3] expand __builtin_bswap*() with constant args Luc Van Oostenryck
2017-02-13  1:54         ` [PATCH v2 0/3] builtins expansion Christopher Li
2017-02-12 23:35       ` [PATCH 2/3] allow builtins to have prototype and evaluate/expand methods Chris Li
2017-01-23 21:37 ` [PATCH 3/3] expand __builtin_bswap*() with constant args Luc Van Oostenryck

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=20170212151100.15868-3-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.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 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.