On Sun, 29 Mar 2020, Christoph Böhmwalder wrote:

> Am 27.03.20 um 17:15 schrieb Julia Lawall:
> >
> >
> > On Fri, 27 Mar 2020, Christoph Böhmwalder wrote:
> >
> > > Am 27.03.20 um 16:47 schrieb Julia Lawall:> Are you sure that the C code
> > > is
> > > parsed successfully?  I'm not at all sure
> > > > that static is allowed in an argument list.  Types are allowed, bu
> > > > static
> > > > is only part of a type.
> > >
> > > I'm pretty sure it is parsed successfully. At least spatch doesn't
> > > complain
> > > about it, no matter how many debug flags I specify.
> >
> > Did you try spatch --parse-c file.c?
>
> It seems like RB_DECLARE_CALLBACKS_MAX is recognized as a "known macro"? Looks
> like it is able to parse this bit of code just fine:
>
> $ spatch --parse-c drbd/drbd_interval.c --debug
> init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
>
> PARSING: drbd/drbd_interval.c
> parse error
>  = error in drbd/drbd_interval.h; set verbose_parsing for more info
> badcount: 5
> bad:                                    unsigned int);
> bad:
> bad: #define drbd_for_each_overlap(i, root, sector, size)               \
> bad:    for (i = drbd_find_overlap(root, sector, size);         \
> bad:         i;                                                 \
> BAD:!!!!!            i = drbd_next_overlap(i, sector, size))
> (ONCE) CPP-MACRO: found known macro = RB_DECLARE_CALLBACKS_MAX
> passed:static , augment_callbacks , struct drbd_interval , rb ,
> passed:sector_t , end , NODE_END

It's not parsing anything.  You can see that here.  It is passing, ie
ignoring, the entire command line.

I don't remember the exact situation with this code.  Is there no
semicolon at the end of the macro line?

julia


> -----------------------------------------------------------------------
> maybe 10 most problematic tokens
> -----------------------------------------------------------------------
> -----------------------------------------------------------------------
> NB total files = 1; perfect = 1; pbs = 0; timeout = 0; =========> 100%
> nb good = 160,  nb passed = 2 =========> 1.23% passed
> nb good = 160,  nb bad = 0 =========> 100.00% good or passed
>
> > Do you want to actually match NODE_END?  If so, it shouldn't be declared
> > as a metavariable.
>
> Right, I do want to exactly match NODE_END, so I removed the declaration;
> still no match though. If it is detected as a known macro it should be able to
> be substituted, right?
>
> >
> > julia
> >
>
> Thanks,
> --
> Christoph Böhmwalder
> LINBIT | Keeping the Digital World Running
> DRBD HA —  Disaster Recovery — Software defined Storage
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to