Hey everyone,
In Fedora rawhide and 42 GCC has been updated to version 15 which
introduces a switch of default C standard to gnu23. This unfortunately
causes failure to build guile 3.0.10 since it changes behavior of function
declaration without parameters described here [0]. scm_t_subr type is using
this exact behavior and thus gcc 15 fails to compile it without reverting
the standard back to the previous gnu17. I am not sure whether there is a
fix which can keep the type checking and allow different arity of functions
as is noted in comment of sct_t_subr type declaration in scm.h file.

# scm.h:812
/* The type of subrs, i.e., Scheme procedures implemented in C.  Empty
   function declarators are used internally for pointers to functions of
   any arity.  However, these are equivalent to `(void)' in C++, are
   obsolescent as of C99, and trigger `strict-prototypes' GCC warnings
   (bug #23681).  */
#ifdef BUILDING_LIBGUILE
typedef SCM (* scm_t_subr) ();
#else
typedef void *scm_t_subr;
#endif

Error in question:
control.c: In function 'scm_init_ice_9_control':
control.c:152:23: error: passing argument 5 of 'scm_c_define_gsubr' from
incompatible pointer type [-Wincompatible-pointer-types]
  152 |                       scm_suspendable_continuation_p);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       struct scm_unused_struct * (*)(struct
scm_unused_struct *)
In file included from control.c:29:
gsubr.h:72:71: note: expected 'scm_t_subr' {aka 'struct scm_unused_struct *
(*)(void)'} but argument is of type 'struct scm_unused_struct * (*)(struct
scm_unused_struct *)'
   72 |                                 int req, int opt, int rst,
scm_t_subr fcn);
      |
 ~~~~~~~~~~~^~~
control.c:135:1: note: 'scm_suspendable_continuation_p' declared here
  135 | scm_suspendable_continuation_p (SCM tag)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from dynstack.h:28,
                 from control.c:26:
../libguile/scm.h:818:16: note: 'scm_t_subr' declared here
  818 | typedef SCM (* scm_t_subr) ();
      |                ^~~~~~~~~~

[0] -
https://gcc.gnu.org/gcc-15/porting_to.html#c23-fn-decls-without-parameters

Reply via email to