Skip to content

scm_t_subr typedef for guile < 2.0 #76

@stevengj

Description

@stevengj

Right now the generated code produces a lot of calls like:

gh_new_procedure("material-grids-approx-gradient-aux", (SCM(*) ()) material_grids_approx_gradient_aux, 4, 0, 0);

where SCM(*) () was the old (pre-1.0) type of this argument, changed to void * in guile 2.0 by cky/guile@be90d0b … on modern C compilers, this old-style C declaration is deprecated and can yield compiler warnings.

Note that gh_new_procedure itself was replaced by scm_c_define_gsubr a long time ago, which was worked around with a #define for backwards compatibility here:

libctl/src/ctl.h.in

Lines 98 to 101 in 5a8155b

#define gh_new_procedure(name, fcn, req, opt, rst) \
scm_c_define_gsubr(name, req, opt, rst, (scm_t_subr)(fcn))
#else
#define gh_new_procedure(name, fcn, req, opt, rst) scm_c_define_gsubr(name, req, opt, rst, fcn)

Probably we should just drop guile < 2.0 soon — guile 2.0 was released in 2011.

However, in the meantime we should spit out a (scm_t_subr) cast instead of (SCM(*) ()), and have a backward-compatibility typedef SCM (* scm_t_subr) (); here:

#define gh_new_procedure(name, fcn, req, opt, rst) scm_c_define_gsubr(name, req, opt, rst, fcn)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions