From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, John Snow <jsnow@redhat.com>
Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] add macro file for coccinelle
Date: Wed, 9 Sep 2015 11:51:21 +0200 [thread overview]
Message-ID: <55F00119.4000305@redhat.com> (raw)
In-Reply-To: <87r3m8g3na.fsf@blackfin.pond.sub.org>
On 08/09/2015 20:35, Markus Armbruster wrote:
>> > Having not used Coccinelle yet, what happens if any of these functions
>> > become desynchronized ?
> Coccinelle transforms C to C. Problem: if you parse C the normal way
> (first run preprocessor, then the parser proper), you have to unparse
> and unpreprocess at the end to get a useful result. Unparsing is easy,
> but unpreprocessing is hard.
>
> Instead, Coccinelle tries to parse *unpreprocessed* C. Works most of
> the time, because most uses of function-like macros can be treated as if
> they were function calls, and most uses of object-like macros can be
> treated as if they were values.
>
> When it doesn't work, Coccinelle needs to resort to magic and / or skip
> over some code it can't decipher. The latter is undesirable, because if
> the skipped code contains something we'd like to transform, we won't.
>
> Part of the magic is treating "bad" macros specially. --macro-file
> helps with that part: macros defined there are "bad". Sorry, I can't
> really explain it, -EMAGIC. /usr/share/coccinelle/standard.h is used by
> default.
>
> So what happens when the this file gets out of sync? Worst case is
> Coccinelle misses a pattern it could find if it was in sync.
>
> Provided the macro file makes sense initially, a moderately bit-rotten
> version is still almost certainly better than nothing.
Great answer. I'll only add that exactly the same issue happens with
the Coverity model.
Paolo
next prev parent reply other threads:[~2015-09-09 9:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-07 10:21 [Qemu-devel] [PATCH v2] add macro file for coccinelle Paolo Bonzini
2015-09-08 11:10 ` Markus Armbruster
2015-09-08 12:44 ` Paolo Bonzini
2015-09-08 13:08 ` Markus Armbruster
2015-09-08 13:31 ` [Qemu-devel] [Qemu-trivial] " Marcel Apfelbaum
2015-09-08 17:30 ` [Qemu-devel] " John Snow
2015-09-08 18:35 ` Markus Armbruster
2015-09-09 9:51 ` Paolo Bonzini [this message]
2015-09-10 21:23 ` John Snow
2015-09-15 17:55 ` Michael Tokarev
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=55F00119.4000305@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).