Skip to content

IGRAPH_FINALLY() and IGRAPH_FINALLY_REAL() #1613

@krlmlr

Description

@krlmlr

CSan checks complain about our hack in IGRAPH_FINALLY() calling IGRAPH_FINALLY_REAL() with a cast function pointer: https://github.com/igraph/rigraph/actions/runs/12108577215/job/33756736066#step:6:10130 . My most recent submission got rejected from CRAN because of this.

Propose to only use IGRAPH_FINALLY_REAL() instead of IGRAPH_FINALLY() in the R interface, and create wrapper functions for each function called:

# Bad:
IGRAPH_FINALLY(igraph_vector_int_destroy, &news);

# Good:
IGRAPH_FINALLY_REAL(igraph_vector_int_destroy_pv, &news);

void igraph_vector_int_destroy_pv(void* v) {
  igraph_vector_int_destroy((magic_cast*)v);
}

(For some magic_cast we'd have to figure out. I can't quite parse igraph_vector.h . These days, I'd write a code generator and commit the generated code to version control, instead of this complex preprocessor logic because I find that easier to read.)

@szhorvat @ntamas: What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    upkeepmaintenance, infrastructure, and similar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions