Mentions légales du service

Skip to content

improve management of function types

LAWALL Julia requested to merge funtype into master

Previously, function identifiers got types that did not include the (*) information. This causes pretty printing not to work. Simply adding the corresponding AST nodes, however, is not sufficient, because typedef_fix strips off the resulting outermost ParenType. The goal of doin that is to expose the fact that it is a pointer type, so that it can match against a metavaraible declared as T *e; ie match any pointer-typed expression. So additionally update compatible_typeC to consider that a SmPL pointer type is compatible with a ParenType, if unfolding the ParenType reveals a matching pointer type.

The first test case, fptr, ensures that a type metavariable gets bound to a function type in the right way. It is also useful to run spatch --type-c fptr.c and to check that a function type is printed. The second test case, fptr3, checks the case of T * e;

Sergey Staroletov serg_soft@mail.ru first detected that function types were not being printed properly.

Merge request reports