All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: linux-mips@linux-mips.org
Cc: joe@perches.com, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH 0/7] delete double assignment
Date: Sat, 23 Aug 2014 20:33:21 +0200	[thread overview]
Message-ID: <1408818808-18850-1-git-send-email-Julia.Lawall@lip6.fr> (raw)

These patches fix cases where there are two adjacent assignments to the
same location.  In practice, many such occurrences appear to be
intentional, eg to initialize volatile memory, but these cases do not seem
to fall into that category.

The complete semantic match that finds these problems is as follows:

// <smpl>
@r@
expression i,f;
position p1,p2;
@@

(
 i = <+...f(...)...+>;
|
 i |= <+...f(...)...+>;
|
 i &= <+...f(...)...+>;
|
 i += <+...f(...)...+>;
|
 i -= <+...f(...)...+>;
|
 i *= <+...f(...)...+>;
|
 i /= <+...f(...)...+>;
|
 i %= <+...f(...)...+>;
|
 i ^= <+...f(...)...+>;
|
 i <<= <+...f(...)...+>;
|
 i >>= <+...f(...)...+>;
|
 i@p1 = ...;
|
 i@p1 |= ...;
|
 i@p1 &= ...;
|
 i@p1 += ...;
|
 i@p1 -= ...;
|
 i@p1 *= ...;
|
 i@p1 /= ...;
|
 i@p1 %= ...;
|
 i@p1 ^= ...;
|
 i@p1 <<= ...;
|
 i@p1 >>= ...;
|
 i@p1 ++;
|
 ++i@p1;
|
 i@p1 --;
|
 --i@p1;
)
(
 i = <+...i...+>;
|
 i = <+...f(...)...+>;
|
 i@p2 = ...;
)

@@
expression i,j,f;
position r.p1,r.p2;
@@

(
 (<+...i@p1...+>);
)
(
 (<+...\(j++\|++j\|j--\|--j\|f(...)\)...+>) = ...;
|
*i@p2 = ...;
)
// </smpl>


WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: linux-mips@linux-mips.org
Cc: joe@perches.com, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH 0/7] delete double assignment
Date: Sat, 23 Aug 2014 18:33:21 +0000	[thread overview]
Message-ID: <1408818808-18850-1-git-send-email-Julia.Lawall@lip6.fr> (raw)

These patches fix cases where there are two adjacent assignments to the
same location.  In practice, many such occurrences appear to be
intentional, eg to initialize volatile memory, but these cases do not seem
to fall into that category.

The complete semantic match that finds these problems is as follows:

// <smpl>
@r@
expression i,f;
position p1,p2;
@@

(
 i = <+...f(...)...+>;
|
 i |= <+...f(...)...+>;
|
 i &= <+...f(...)...+>;
|
 i += <+...f(...)...+>;
|
 i -= <+...f(...)...+>;
|
 i *= <+...f(...)...+>;
|
 i /= <+...f(...)...+>;
|
 i %= <+...f(...)...+>;
|
 i ^= <+...f(...)...+>;
|
 i <<= <+...f(...)...+>;
|
 i >>= <+...f(...)...+>;
|
 i@p1 = ...;
|
 i@p1 |= ...;
|
 i@p1 &= ...;
|
 i@p1 += ...;
|
 i@p1 -= ...;
|
 i@p1 *= ...;
|
 i@p1 /= ...;
|
 i@p1 %= ...;
|
 i@p1 ^= ...;
|
 i@p1 <<= ...;
|
 i@p1 >>= ...;
|
 i@p1 ++;
|
 ++i@p1;
|
 i@p1 --;
|
 --i@p1;
)
(
 i = <+...i...+>;
|
 i = <+...f(...)...+>;
|
 i@p2 = ...;
)

@@
expression i,j,f;
position r.p1,r.p2;
@@

(
 (<+...i@p1...+>);
)
(
 (<+...\(j++\|++j\|j--\|--j\|f(...)\)...+>) = ...;
|
*i@p2 = ...;
)
// </smpl>


             reply	other threads:[~2014-08-23 18:37 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-23 18:33 Julia Lawall [this message]
2014-08-23 18:33 ` [PATCH 0/7] delete double assignment Julia Lawall
2014-08-23 18:33 ` [PATCH 1/7] video: fbdev: riva: " Julia Lawall
2014-08-23 18:33   ` Julia Lawall
2014-08-23 18:33 ` [PATCH 2/7] video: fbdev: intelfb: " Julia Lawall
2014-08-23 18:33   ` Julia Lawall
2014-08-26 10:56   ` Tomi Valkeinen
2014-08-26 10:56     ` Tomi Valkeinen
2014-08-23 18:33 ` [PATCH 3/7] serial: vr41xx_siu: " Julia Lawall
2014-08-23 18:33   ` Julia Lawall
2014-08-23 18:33 ` [PATCH 4/7] MIPS: BCM63xx: " Julia Lawall
2014-08-23 18:33   ` Julia Lawall
2014-08-25 11:27   ` Ralf Baechle
2014-08-25 11:27     ` Ralf Baechle
2014-08-25 19:09     ` Jonas Gorski
2014-08-25 19:09       ` Jonas Gorski
2014-08-23 18:33 ` [PATCH 5/7] wusb: " Julia Lawall
2014-08-23 18:33   ` Julia Lawall
2014-08-23 18:33 ` [PATCH 6/7] video: fbdev: sis: " Julia Lawall
2014-08-23 18:33   ` Julia Lawall
2014-08-24 18:21   ` Geert Uytterhoeven
2014-08-24 18:21     ` Geert Uytterhoeven
2014-08-24 18:40     ` Julia Lawall
2014-08-24 18:40       ` Julia Lawall
2014-08-25 11:36       ` Geert Uytterhoeven
2014-08-25 11:36         ` Geert Uytterhoeven
2014-08-26 10:51     ` Tomi Valkeinen
2014-08-26 10:51       ` Tomi Valkeinen
2014-08-23 18:33 ` [PATCH 7/7] MIPS: Alchemy: au1200fb: " Julia Lawall
2014-08-23 18:33   ` 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=1408818808-18850-1-git-send-email-Julia.Lawall@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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.