From: Julia Lawall <julia@diku.dk>
To: Emese Revfy <re.emese@gmail.com>
Cc: Kees Cook <kees.cook@canonical.com>,
linux-kernel@vger.kernel.org, cocci@diku.dk
Subject: Re: [Cocci] Re: status of constification
Date: Mon, 6 Jun 2011 09:49:04 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.1106060948050.17498@ask.diku.dk> (raw)
In-Reply-To: <4DEBF96D.3030209@gmail.com>
On Sun, 5 Jun 2011, Emese Revfy wrote:
> > Could I see the semantic patch? The clean up issue sounds interesting.
> > Perhaps there is a way around it.
>
> Hi,
> I no longer use Coccinelle to generate constification patch, but only to find
> candidate structures for constification. This is because I ran into several
> issues
> some of which I will try describe now from memory (unfortunately I don't have
> those Cocci scripts anymore):
>
> 1. Sometimes (always?) cocci removed NULL initialization while emitting the
> constified patch:
>
> linux-2.6.39-rc7/arch/frv/mb93090-mb00/pci-vdk.c
> @@ -356,7 +356,7 @@ void __init pcibios_fixup_bus(struct pci
>
> int __init pcibios_init(void)
> {
> - struct pci_ops *dir = NULL;
> + const struct pci_ops *dir;
>
> if (!mb93090_mb00_detected)
> return -ENXIO;
>
> 2. Sometimes (always?) cocci joined structure field lines into one line while
> constifying them:
>
> linux-2.6.39-rc7/arch/x86/include/asm/x86_init.h
> @@ -119,14 +119,7 @@ struct x86_init_pci {
> *
> */
> struct x86_init_ops {
> - struct x86_init_resources resources;
> - struct x86_init_mpparse mpparse;
> - struct x86_init_irqs irqs;
> - struct x86_init_oem oem;
> - struct x86_init_paging paging;
> - struct x86_init_timers timers;
> - struct x86_init_iommu iommu;
> - struct x86_init_pci pci;
> + const struct x86_init_resources resources;const struct
> x86_init_mpparse mpparse;const struct x86_init_irqs irqs;const struct
> x86_init_oem oem;const struct x86_init_paging paging;const struct
> x86_init_timers timers;const struct x86_init_iommu iommu;const struct
> x86_init_pci pci;
> };
This problem seem to be solved. At least, I don't see the problem for the
following semantic patch:
@@
identifier i,x;
type T;
@@
struct i {
...
- T x;
+ const T x;
...
};
on the following code:
struct i {
int a;
int b;
/* a comment */
int c;
int d;
};
The comment is preserved as well.
julia
> /**
>
> 3. Sometimes cocci removed comment lines while joining others, maybe related
> to the previous issue:
> linux-2.6.39-rc7/drivers/net/wireless/ath/ath9k/hw.h
> @@ -753,9 +753,7 @@ struct ath_hw {
> } enable_32kHz_clock;
>
> /* Private to hardware code */
> - struct ath_hw_private_ops private_ops;
> - /* Accessed by the lower level driver */
> - struct ath_hw_ops ops;
> + const struct ath_hw_private_ops private_ops;const struct ath_hw_ops
> ops;
>
> /* Used to program the radio on non single-chip devices */
> u32 *analogBank0Data;
>
> 4. My constification patch generator cocci script didn't find all structures
> that it should have, I don't know whether it was a bug in my script or in
> cocci but in the end I just gave it up.
>
> --
> Emese
>
>
next prev parent reply other threads:[~2011-06-06 7:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 22:38 Kees Cook
2010-11-09 21:54 ` Emese Revfy
[not found] ` <4CD9BF25.4090306@gmail.com>
2010-11-10 6:35 ` [Cocci] " Julia Lawall
2010-11-11 21:48 ` Emese Revfy
2010-11-11 22:53 ` Julia Lawall
2010-11-13 12:13 ` Emese Revfy
2010-11-13 13:43 ` Julia Lawall
2010-11-13 14:41 ` Julia Lawall
2011-05-28 3:13 ` Kees Cook
2011-05-28 6:39 ` [Cocci] " Julia Lawall
2011-06-05 21:47 ` Emese Revfy
2011-06-06 5:03 ` Julia Lawall
2011-06-06 7:49 ` Julia Lawall [this message]
2011-06-10 21:28 ` Emese Revfy
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=Pine.LNX.4.64.1106060948050.17498@ask.diku.dk \
--to=julia@diku.dk \
--cc=cocci@diku.dk \
--cc=kees.cook@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=re.emese@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®