On Mon, Jul 07, 2025 at 02:37:44PM +0200, Patrick Dupre via users wrote:
> Hello,
> 
> I am trying to generate a rpm package (perl-Tk-Zinc) from a source file.
> No problem in fedora 40, but it fails in fedora 42
> The reason seems to be due to gcc:  gcc 14 in fedora 40, and gcc 15 in fedora 
> 15
>  
> Th error message is 
> Field.c:1746:8: error: too many arguments to function ‘cb’; expected 0, have 9
>  1746 |       (*cb)(wi, fptr, &bbox, &pm_bbox,
>       |       ~^~~~ ~~
> Field.c: In function ‘RenderField’:
> 
> 
> It is due to 
> static void
> FieldsEngine(ZnFieldSet field_set,
>              void       (*cb)())
> {
>   ZnWInfo       *wi = field_set->item->wi;
>   /*int         i;      This one *NEED* to be an int */
>   unsigned int  i, num_fields, num_chars;
>   Field         fptr;
>   ZnTextInfo    *ti = &wi->text_info;
>   ZnBBox        lclip_bbox, fclip_bbox, bbox, *global_clip_box;
>   ZnBBox        tmp_bbox, text_bbox, pm_bbox;
>   ZnPoint       pts[2];
>   ZnTriStrip    tristrip;
>   ZnPoint       text_pos;
>   ZnBool        restore = False;
>   ZnDim         lwidth, lheight;
>   ZnReal        val;
>   int           cursor;
>   int           sel_start, sel_stop;
> 
>   if (!field_set->num_fields) {
>     return;
>   }
> 
> with the call
> 
>       (*cb)(wi, fptr, &bbox, &pm_bbox,
>             &text_pos, &text_bbox, cursor, sel_start, sel_stop);

That is invalid C23, and GCC 15 defaults to -std=gnu23.
In C17 and earlier, type fn (); meant a function with type return type
and unspecified arguments, in C23 this means the same as in C++,
function with no arguments, same as type fn (void);
If cb is only used for functions with 9 arguments with compatible types,
then fix it by changing void (*cb)() to
void (*cb)(ZnWinfo *, Field, ZnBBox *, ZnBBox *, ZnPoint *, ZnBBox *, int, int, 
int)
If it is used for functions with different argument types and their count,
then you need to rework the code.  Perhaps it could use ... functions (but
note that all the functions passed to it have to be then declared and
defined with ...), or pass union of several different function pointers,
whatever.

Or temporarily use -std=gnu17.

See also https://gcc.gnu.org/gcc-15/porting_to.html#c23

        Jakub

-- 
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
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/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue
  • gcc Patrick Dupre via users
    • Re: gcc Jakub Jelinek

Reply via email to