Message ID | 20170816153455.97693-7-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
On Wed, Aug 16, 2017 at 11:34 AM, Luc Van Oostenryck <luc.vanoostenryck@gmail.com> wrote: > > > + if (!sym->ident) { // top-level asm Maybe here we should check the statement is really top-level asm? Later on we might have more than top-level asm as with sym->ident == NULL. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Aug 17, 2017 at 8:49 AM, Christopher Li <sparse@chrisli.org> wrote: >> >> + if (!sym->ident) { // top-level asm > > Maybe here we should check the statement is really top-level asm? > Later on we might have more than top-level asm as with sym->ident == NULL. Sure but it's currently how they must be detected. In fact (like the name may suggest) this patch is part of a series that better deal with top-level asm (they are not really statement!'). For example, top-level asm must be parsed as basic asm and not extended asm. So yes, I totally agree, but not now. -- Luc -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Aug 17, 2017 at 3:22 PM, Luc Van Oostenryck <luc.vanoostenryck@gmail.com> wrote: > > Sure but it's currently how they must be detected. > > In fact (like the name may suggest) this patch is part of a series > that better deal with top-level asm (they are not really statement!'). > For example, top-level asm must be parsed as basic asm and not > extended asm. > > So yes, I totally agree, but not now. Yes. I haven't finish looking at your series yet. Still working on it. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/linearize.c b/linearize.c index e3d234e7e..298991dcd 100644 --- a/linearize.c +++ b/linearize.c @@ -2200,6 +2200,11 @@ static struct entrypoint *linearize_fn(struct symbol *sym, struct symbol *base_t add_one_insn(ep, entry); ep->entry = entry; + if (!sym->ident) { // top-level asm + linearize_statement(ep, base_type->stmt); + return ep; + } + concat_symbol_list(base_type->arguments, &ep->syms); /* FIXME!! We should do something else about varargs.. */
Top-level asm is parsed as a fake anonymous function. Obviously it also doesn't have a return type and such and this may complicate things if we continue to treat it as a function. Avoid potential problems by special casing it and returning early in linearize_fn(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- linearize.c | 5 +++++ 1 file changed, 5 insertions(+)