NotFound wrote:
Hello.

The current grammar for ATTR in pmc2c allows declarations of the form:
<type> * varname

In the perl6multisub pmc we have the attribute candidates_sorted whose
intended type is candidate_info **, having two problems:

The current grammar allows a single pointer, not a pointer to a
pointer. This can be easily solved.

candidate_info is a struct declared in the pmc file (as typedef struct
candidate_info { ... } candidate_info), then his declaration is not
viewable at the point of inclusion of the generated h file. This can
be solved by declaring the ATTR with type struct candidate_info
instead of candidate_info, but the grammar for ATTR does not allow it.

I think that allowing struct in ATTR is the simpler solution to the
second problem, because the intended usage is for struct used
internally in the pmc, not for his documented interface.

The attached patch changes the ATTR grammar and uses the changes to
clean the workarounds currently used in perl6multsub pmc. It passes
all coretest on my system, both building with C or with C++.

Approved for application. But, keep in mind that ATTRs other than INTVAL, FLOATVAL, STRING *, and PMC * cannot have automatic GET_ATTR/SET_ATTR accessor macros generated for them, and any C PMCs with these low-level ATTRs cannot be subclassed from PIR/HLLs.

Allison

Reply via email to