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: Wed, 30 Aug 2017 04:55:10 -0700	[thread overview]
Message-ID: <1504094110.2786.18.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1708301334550.3184@hadrien>

On Wed, 2017-08-30 at 13:41 +0200, Julia Lawall wrote:
> The main rule is "worrisome", which will set a position variable if any
> field is not a constant.??This considers anything that is in all capital
> letters to be a constant, which is not safe.??To forbid all arrays that
> contain any identifier, in capital letters or not, one could convert
> \(c\|e at bad\)
> 
> to
> 
> \(i at bad\|c\|e at bad\)
[]
> diff -u -p a/drivers/video/fbdev/tmiofb.c b/drivers/video/fbdev/tmiofb.c
> --- a/drivers/video/fbdev/tmiofb.c
> +++ b/drivers/video/fbdev/tmiofb.c
> @@ -436,7 +436,7 @@ static int tmiofb_sync(struct fb_info *f
> ?static void
> ?tmiofb_fillrect(struct fb_info *fbi, const struct fb_fillrect *rect)
> ?{
> -???????const u32 cmd[] = {
> +???????static const u32 cmd[] = {
> ????????????????TMIOFB_ACC_DSADR((rect->dy * fbi->mode->xres + rect->dx) * 2),
> ????????????????TMIOFB_ACC_DHPIX(rect->width - 1),
> ????????????????TMIOFB_ACC_DVPIX(rect->height - 1),

False positives like the above exist in the attachment so
it seems the additional check is necessary.

  reply	other threads:[~2017-08-30 11:55 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 [this message]
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
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=1504094110.2786.18.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.