On Mon, 25 Feb 2019, Timur Tabi wrote:
> On Mon, Feb 25, 2019 at 5:06 PM Timur Tabi <[email protected]> wrote:
> > Sorry, bad copy-paste. I meant
> >
> > #define FLD_SET_DRF(a, b, c, d, e) 1
>
> Ok, now I found something weird.
>
> If I put the #define on the top of the source file (test.c), it doesn't work.
>
> But if I put it in a header file specified by --macro-file-builtins,
> it does work.
>
> So it seems to me that spatch is parsing the macros in the
> --macro-file-builtins header file differently than the macros in the
> source file itself. That doesn't explain why it doesn't like 0080,
> though.
It doesn't like 0080 because that's not an octal number. Octal numbers
should only have digits up to 7.
On the other hand, when I try to parse the function in isolation, it fails
for a few parsing rounds, but then succeeds in the end.
Coccinelle tries to avoid unfolding macros, because doing so means that
the macro code can't be transformed. --macro-file-builtins means use
these definitions immediately when parsing. --macro-file definitions are
used in a later parsing attempt. I think that macro definitions in the
code are only used when they have an impact on control-flow, ie a macro
definition that contains a return. So what you see is the intended
behavior.
julia
>
> Anyway, I seem to be unblocked for now, but this might be something to
> look into.
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci