All of lore.kernel.org
 help / color / mirror / Atom feed
From: joe@perches.com (Joe Perches)
To: cocci@systeme.lip6.fr
Subject: [Cocci] cocci script to add static to const declarations ?
Date: Thu, 31 Aug 2017 13:06:31 -0700	[thread overview]
Message-ID: <1504209991.2786.45.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1708312123450.1984@hadrien>

On Thu, 2017-08-31 at 21:25 +0200, Julia Lawall wrote:
> On Thu, 31 Aug 2017, Joe Perches wrote:
> > On Thu, 2017-08-31 at 16:22 +0200, Julia Lawall wrote:
> > > On Wed, 30 Aug 2017, Joe Perches wrote:
> > > > fyi: This doesn't find const structs that could be static.
> > > > 
> > > > Things like: drivers/gpu/drm/i915/selftests/i915_vma.c
> > > > []
> > > > static int igt_vma_rotate(void *arg)
> > > > {
> > > > []
> > > > 	const struct intel_rotation_plane_info planes[] = {
> > > > 		{ .width = 1, .height = 1, .stride = 1 },
> > 
> > []
> > > > 		{ }
> > > > 	}, *a, *b;
> > > 
> > > Here's a new version.  Unfortuntely, the ability of Coccinelle to break up
> > > declarations of multiple variables like the above (planes, a, and b) is
> > > rather limited.  So it doesn't get the above case.  But it does get some
> > > others that have structures containing constants.  The new output is
> > > attached.  You also need the latest version of Coccinelle from github.
> > 
> > Thanks again.  This looks very good to me.
> > 
> > Could you (or one of your minions) please submit these?
> 
> I think there was a discussion recently that suggested that one should
> just submit a patch to gcc instead of 100 patches to the Linux kernel?

That's of course a good idea, but older versions
of gcc (4,5,6, and probably 7 too) would not be
fixed.

> > gcc doesn't currently optimize these declarations into
> > .text sections and instead places these bits onto stack
> > along with initialization code for these bits.
> > 

  reply	other threads:[~2017-08-31 20:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 10:49 [Cocci] cocci script to add static to const declarations ? Joe Perches
2017-08-30 11:12 ` SF Markus Elfring
2017-08-30 11:41 ` Julia Lawall
2017-08-30 11:55   ` Joe Perches
2017-08-30 20:48     ` Julia Lawall
2017-08-30 21:41     ` Julia Lawall
2017-08-30 22:33       ` Joe Perches
2017-08-31  5:04         ` Julia Lawall
2017-08-31 14:22         ` Julia Lawall
2017-08-31 18:11           ` Joe Perches
2017-08-31 19:25             ` Julia Lawall
2017-08-31 20:06               ` Joe Perches [this message]
2017-08-30 12:38   ` Joe Perches
2017-08-30 13:02     ` Julia Lawall

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=1504209991.2786.45.camel@perches.com \
    --to=joe@perches.com \
    --cc=cocci@systeme.lip6.fr \
    /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.