On Wed, Jan 22, 2025 at 04:57:40PM -0700, Jerry James wrote: > On Wed, Jan 22, 2025 at 4:43 PM Chuck Anderson <cra@xxxxxx> wrote: > > It looks like most (all?) perl XS packages ('C' implementations of Perl functions) are FTBFS with GCC 15. I'm trying to fix perl-Term-ReadLine-Gnu to be C23-compatible. The workaround is to add -std=gnu17 to the CFLAGS which can be done via OPTIMIZE for MakeMaker builds like this: > > > > /usr/bin/perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS -std=gnu17" NO_PACKLIST=1 NO_PERLLOCAL=1 > > > > but I don't really know how to fix these the "right" way: > > The issue is that "typedef int XFunction ();" used to say in C17 that > an XFunction returned an int and took an undeclared number and type of > parameters. With C23, that says that an XFunction takes zero > parameters; i.e., it is equivalent to "typedef int XFunction (void);". > Try this patch: This is not correct. Varargs functions like (...) are not compatible with non-varargs functions (so e.g. one which takes (FILE *), etc.). E.g. on x86-64 they have slightly different ABI (the varargs function need %rax to be number of floating point ... arguments) while non-vargs doesn't, but there could be other arches where it is completely ABI incompatible. Also note that (...) is new in C23, before that one had to specify at least one named argument before that. If rlfuncp uses some set of argument types but in each case the same, defaultfn possibly another and wrapper yet another, just create typedefs for all 3. Or if you are willing to be outside of C standard but within POSIX, dlsym just returns a void * even for pointers to function and one can cast that to whatever function pointer type one needs before calling a function through it. > --- Term-ReadLine-Gnu-1.46/Gnu.xs.orig 2023-07-01 03:13:00.000000000 -0600 > +++ Term-ReadLine-Gnu-1.46/Gnu.xs 2025-01-22 16:55:10.392537797 -0700 > @@ -613,16 +613,31 @@ enum { STARTUP_HOOK, EVENT_HOOK, GETC_FN > SIG_EVT, INP_AVL, FN_STAT, TIMEOUT_EVENT, > }; > > -typedef int XFunction (); > +typedef int XFunction (...); > static struct fn_vars { > XFunction **rlfuncp; /* GNU Readline Library variable */ > XFunction *defaultfn; /* default function */ > XFunction *wrapper; /* wrapper function */ > SV *callback; /* Perl function */ > } fn_tbl[] = { > - { &rl_startup_hook, NULL, startup_hook_wrapper, NULL }, /* 0 */ > - { &rl_event_hook, NULL, event_hook_wrapper, NULL }, /* 1 */ > - { &rl_getc_function, rl_getc, getc_function_wrapper, NULL }, /* 2 */ > + { > + (XFunction **)&rl_startup_hook, /* 0 */ > + NULL, > + (XFunction *)startup_hook_wrapper, > + NULL > + }, > + { > + (XFunction **)&rl_event_hook, /* 1 */ > + NULL, > + (XFunction *)event_hook_wrapper, > + NULL > + }, > + { > + (XFunction **)&rl_getc_function, /* 2 */ > + (XFunction *)rl_getc, > + (XFunction *)getc_function_wrapper, > + NULL > + }, > { > (XFunction **)&rl_redisplay_function, /* 3 */ > (XFunction *)rl_redisplay, > @@ -677,7 +692,12 @@ static struct fn_vars { > (XFunction *)history_inhibit_expansion_function_wrapper, > NULL > }, > - { &rl_pre_input_hook, NULL, pre_input_hook_wrapper, NULL }, /* 12 */ > + { > + (XFunction **)&rl_pre_input_hook, /* 12 */ > + NULL, > + (XFunction *)pre_input_hook_wrapper, > + NULL > + }, > { > (XFunction **)&rl_completion_display_matches_hook, /* 13 */ > NULL, > Jakub -- _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue