# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/gpm/hotfix-yacc.patch # Copyright (C) 2025 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- From 361de4413b487d1dcd9a1a94b1bb9d5d9b7a2629 Mon Sep 17 00:00:00 2001 From: NHOrus Date: Tue, 11 Feb 2025 19:01:48 +0400 Subject: [PATCH] Fix function definition in yacc source file until valid C23. Fill empty argument lists with values. Add 0 as third argument for two-argument function, it will be ignored at call site. --- src/prog/gpm-root.y | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/prog/gpm-root.y b/src/prog/gpm-root.y index 800e51b..f06872c 100644 --- a/src/prog/gpm-root.y +++ b/src/prog/gpm-root.y @@ -128,7 +128,7 @@ typedef struct DrawItem { char *name; char *arg; /* a cmd string */ void *clientdata; /* a (Draw *) for menus or whatever */ - int (*fun)(); + int (*fun)(int, struct DrawItem *, int); struct DrawItem *next; } DrawItem; @@ -159,7 +159,7 @@ int yyerror(char *s); int yylex(void); DrawItem *cfg_cat(DrawItem *, DrawItem *); -DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(), void *detail); +DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(int, DrawItem *, int), void *detail); /*===================================================================* @@ -195,7 +195,7 @@ int f_pipe(int mode, DrawItem *self, int uid); char *string; Draw *draw; DrawItem *item; - int (*fun)(); + int (*fun)(int, DrawItem *, int); } %token T_STRING @@ -284,7 +284,7 @@ struct tokenName tokenList[] = { struct funcName { char *name; int token; - int (*fun)(); + int (*fun)(int, DrawItem *, int); }; struct funcName funcList[] = { {"f.debug",T_FUNC,f_debug}, @@ -390,7 +390,7 @@ Draw *cfg_alloc(void) /*---------------------------------------------------------------------*/ /* malloc an empty DrawItem and fill it */ -DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(), void *detail) +DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(int, DrawItem *, int), void *detail) { DrawItem *new=calloc(1,sizeof(DrawItem)); @@ -405,7 +405,7 @@ DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(), void *detail) case 'F': /* a function without args */ new->fun=fun; - if (fun) fun(F_CREATE,new); + if (fun) fun(F_CREATE,new,0); break; case 'M': @@ -1047,7 +1047,7 @@ Posted *postmenu(int fd, FILE *f, Draw *draw, int x, int y, int console) } /* sides and items */ for (item=draw->menu; y++, item; item=item->next) { - if (item->fun) (*(item->fun))(F_POST,item); + if (item->fun) (*(item->fun))(F_POST,item,0); GOTO(x,y); PUTC(VERLINE,draw->bord,draw->back); for (i=0;ipad;i++) PUTC(' ',draw->fore,draw->back); PUTS(item->name,draw->fore,draw->back); i+=strlen(item->name);