All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>,
	 Peter Senna Tschudin <peter.senna@linux.intel.com>,
	cocci@inria.fr
Subject: Re: [cocci] Iterator macros
Date: Wed, 14 Aug 2024 10:02:29 +0200 (CEST)	[thread overview]
Message-ID: <8024d45f-028-5e5f-1cb-ec0bdedc72@inria.fr> (raw)
In-Reply-To: <ed88cfd5-2501-4c5c-bbb8-56e30e29b87b@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2222 bytes --]



On Wed, 14 Aug 2024, Andrzej Hajda wrote:

>
>
> On 14.08.2024 09:19, Julia Lawall wrote:
> > > I guess the issue here could be a problem with parsing igt code (it is
> > > also an
> > > issue with kernel drivers using iterators).
> > > Cocci quite often does not recognize automatically iterators or other
> > > constructs, and does not scan them at all.
> > > Try run for example:
> > > $ spatch --parse-c tests/intel/gem_ctx_exec.c
> > > ...
> > > NB total files = 1; perfect = 0; pbs = 1; timeout = 0; =========> 0%
> > > nb good = 385,  nb passed = 19 =========> 3.12% passed
> > > nb good = 385,  nb bad = 204 =========> 66.45% good or passed
> > >
> > > As I understand, lines marked as "bad" are skipped during cocci pass, am I
> > > right?
> > > Some workaround is to define iterators by hand in the script or include
> > > files.
> > The following file:
> >
> > #define igt_main int main ()
> > #define igt_simple_main int main ()
> >
> > #define igt_fixture
> > #define igt_subtest_group
> > #define igt_dynamic(x) YACFE_ITERATOR
> > #define igt_dynamic_f(x) YACFE_ITERATOR
> > #define igt_subtest(x) YACFE_ITERATOR
> > #define igt_subtest_with_dynamic(x) YACFE_ITERATOR
> > #define igt_subtest_with_dynamic_f(x) YACFE_ITERATOR
> > #define igt_subtest_f(x) YACFE_ITERATOR
> > #define igt_until_timeout(x) YACFE_ITERATOR
> > #define igt_while_interruptible(x) YACFE_ITERATOR
> > #define igt_list_for_each_entry_safe_reverse(x) YACFE_ITERATOR
> > #define igt_list_for_each_entry_safe(x) YACFE_ITERATOR
> > #define igt_list_for_each_entry(x) YACFE_ITERATOR
> > #define _Atomic(x) x
> >
> > managed to parse over 98% of the lines in
> >
> > https://gitlab.freedesktop.org/drm/igt-gpu-tools
> >
> > Command line spatch --parse-c . --macro-file-builtins igt.h
> >
> > I'll check on the driver file you mentioned.  Thanks.
>
> Wow, great.
>
> I wonder if it would be possible to issue warning if spatch encounters lines
> which it is not able to parse, to avoid confusion.

The theory is that generally you don't want that, because lost of macros
will trigger warnings, but are not relevant to the change that you want to
make.

But there is an option --verbose-parsing that should provide more
information.

julia

  reply	other threads:[~2024-08-14  8:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13  6:15 [cocci] Iterator macros Peter Senna Tschudin
2024-08-13  6:19 ` Julia Lawall
2024-08-13  6:27   ` Peter Senna Tschudin
2024-08-13  6:34     ` Julia Lawall
2024-08-13 11:05       ` Andrzej Hajda
2024-08-13 11:19         ` Julia Lawall
2024-08-14  7:19         ` Julia Lawall
2024-08-14  7:57           ` Andrzej Hajda
2024-08-14  8:02             ` Julia Lawall [this message]
2024-08-14  7:21         ` Julia Lawall
2024-08-14  6:22     ` Julia Lawall
2024-08-14  9:44 ` 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=8024d45f-028-5e5f-1cb-ec0bdedc72@inria.fr \
    --to=julia.lawall@inria.fr \
    --cc=andrzej.hajda@intel.com \
    --cc=cocci@inria.fr \
    --cc=peter.senna@gmail.com \
    --cc=peter.senna@linux.intel.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 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.