Skip to contentSkip to conversation

parsing_c: Align C AST and Cocci AST for const pointer variants

PATCH Markus Elfring 2 participants 4 messages Feb 8, 2020

lore
Share & tools
lore
#0 lore raw
Quoted 11 lines

For a pointer, the C parser constructed an AST dissimilar from that of the Cocci AST. This caused failures in matching with certain pointer types. For example, for the following case:

char *1 const *2 id;

The C AST constructed would be:
const Pointer1 -> Pointer2 -> char

The Cocci AST constructed would be:
Pointer2 -> const Pointer1 -> char

Which software development tools support to check such information?

Regards,
Markus
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#1 lore raw
Quoted 6 lines · Markus Elfring
Quoted 6 lines

For a pointer, the C parser constructed an AST dissimilar from that of the Cocci AST. This caused failures in matching with certain pointer types. For example, for the following case:

char *1 const *2 id;

Quoted 8 lines
Quoted 5 lines

The C AST constructed would be:
const Pointer1 -> Pointer2 -> char

The Cocci AST constructed would be:
Pointer2 -> const Pointer1 -> char

Which software development tools support to check such information?

A little collection of scripts/tools I've written[1], and the invaluable OCaml debugger :)

Cheers,
Jaskaran.

[1]http://github.com/jajajasalu2/cocci-type-test-suite

Quoted 2 lines

Regards,
Markus

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw

Re: [Cocci] Linux dev-tools: Handling complex types and attributes in Coccinelle

Quoted 1 line

A little collection of scripts/tools I've written[1],

Thanks for your link on another bit of background information.
https://github.com/jajajasalu2/cocci-type-test-suite

Would you like to point any related information sources out?

Quoted 1 line

and the invaluable OCaml debugger :)

This development tool can help occasionally.

I am curious if your contributions will influence also other known open issues for this software in positive ways.

Regards,
Markus
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw

Re: [Cocci] Linux dev-tools: Handling complex types and attributes in Coccinelle

In reply to Jaskaran Singh
Quoted 1 line

A little collection of scripts/tools I've written[1],

Thanks for your link on another bit of background information.
https://github.com/jajajasalu2/cocci-type-test-suite

Would you like to point any related information sources out?

Quoted 1 line

and the invaluable OCaml debugger :)

This development tool can help occasionally.

I am curious if your contributions will influence also other known open issues for this software in positive ways.

Regards,
Markus
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees