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: linux-sparse@vger.kernel.org, Chris Li <sparse@chrisli.org>
Subject: Re: [PATCH] dissect: use built_in_ident() instead of MK_IDENT()
Date: Tue, 20 Jun 2017 18:07:11 +0200	[thread overview]
Message-ID: <20170620160711.GA23849@redhat.com> (raw)
In-Reply-To: <20170620125345.nlchvizgz5ar5yrn@ltop.local>

On 06/20, Luc Van Oostenryck wrote:
>
> On Tue, Jun 20, 2017 at 01:17:41PM +0200, Oleg Nesterov wrote:
> > On 06/19, Luc Van Oostenryck wrote:
> > >
> > > The motivation for this patch was to allow sparse to be
> > > compiled with clang which doesn't like what is done
> > > on VLAs in the MK_IDENT() macro.
> >
> > could you spell please? I don't understand why clang can't compile this
> > code and I am just curious.
>
> Sure, I should have added in the commit message. Here it is:
> 	test-dissect.c:50:16: warning: field 'ident' with variable sized type 'struct ident' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
> 	                sym->ident = MK_IDENT("__asm__");
> 	                             ^
> 	./dissect.h:31:16: note: expanded from macro 'MK_IDENT'
> 	                struct ident ident;                     \
> 	                             ^
> 	test-dissect.c:50:25: error: initialization of flexible array member is not allowed
> 	                sym->ident = MK_IDENT("__asm__");
> 	                                      ^~~~~~~~~
> 	./dissect.h:35:11: note: expanded from macro 'MK_IDENT'
> 	                .name = s,                              \
> 	                        ^

Hmm. Now that I git-cloned the code I understand. And I can't recall why MK_IDENT() was
written this way, it simply doesn't look right. Probably can be fixed but I agree, lets
remove it.

> > > But also, I can't see any justification for not using the
> > > real thing to create identifiers: built_in_ident().
> >
> > Simply because MK_IDENT() is faster and simpler to use.
>
> I find this very weak. For the simplicity of use, in both cases
> there is just a single call with the same argument, for the speed,
> I really really doubt there is any measurable difference.

Yes, I didn't try to convince you this optimization actually makes sense,
just explained the motivation I (probably) had many years ago.

> > >  dissect.h      | 13 -------------
> > >  test-dissect.c |  6 +++---
> > 
> > iirc there should be another MK_IDENT user in dissect.c?
> 
> No, it doesn't seem to, and the history tell that there it
> never had been the case, just the three in test-dissect.c

OK, my memory fooled me.

Thanks,

Oleg.


  reply	other threads:[~2017-06-20 16:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 21:14 [PATCH] dissect: use built_in_ident() instead of MK_IDENT() Luc Van Oostenryck
2017-06-19 22:35 ` Ramsay Jones
2017-06-19 22:42   ` Luc Van Oostenryck
2017-06-20 11:17 ` Oleg Nesterov
2017-06-20 12:53   ` Luc Van Oostenryck
2017-06-20 16:07     ` Oleg Nesterov [this message]
2017-06-20 16:39       ` Luc Van Oostenryck
2017-06-20 16:56         ` Oleg Nesterov

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=20170620160711.GA23849@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --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.