Debian Codegraph @

debian/patches/2303_use-cxx-va-ellipsis.diff

raw
1 Description: '()' is not allowed for variable function arguments.
2 Author: Agustin Martin Domingo <[email protected]>
3 Forwarded: https://sourceforge.net/p/regina-rexx/bugs/612/
4 Bug-Debian: http://bugs.debian.org/1097785
5
6 C23 error message with gci enabled:
7
8 ---
9 ./gci/gci_call.c: In function 'doCall':
10 ./gci/gci_call.c:75:8: error: too many arguments to function '(void (*)(void))func'
11 75 | ((void (*)())func)( GCI_PASSARGS( buf ) );
12 | ~^~~~~~~~~~~~~~~~~
13 ./gci/gci_call.c:63:33: error: too many arguments to function '(signed char (*)(void))func'
14 63 | ((type (*)())func)( GCI_PASSARGS( buf ) ); \
15 | ~^~~~~~~~~~~~~~~~~
16
17 ---
18
19 Seems that there were two changes in C23 regarding variable
20 arguments list in function definitions. On the one hand, '()'
21 seems to mean now void and only void, and no longer a non
22 specified variable argument list. On the other hand, plain
23 C++ ellipsis is now accepted for that purpose, without a
24 first explicit argument type.
25
26 This patch tries to use ellipsis when possible, be it C++ or
27 C (>=C23).
28
29 --- a/gci/gci_call.c
30 +++ b/gci/gci_call.c
31 @@ -37,6 +37,10 @@
32
33 static void *returnValue;
34
35 +#if defined __cplusplus || ( __STDC_VERSION__ >= 202000 )
36 +# define USE_CXX_VA_ELLIPSIS 1
37 +#endif
38 +
39 GCI_JUMPVAR(safetyRope)
40
41 /*
42 @@ -53,7 +57,7 @@ static void doCall( void (*func)(),
43 const GCI_parseinfo *info,
44 const GCI_STACK_ELEMENT *buf )
45 {
46 -#ifdef __cplusplus
47 +#ifdef USE_CXX_VA_ELLIPSIS
48 # define DOCALL(type) *((type *) returnValue) = \
49 ((type (*)(...))func)( GCI_PASSARGS( buf ) ); \
50 GCI_JUMP( GCI_JUMP_GETVAR( safetyRope ), 1 ); \
51 @@ -69,7 +73,7 @@ static void doCall( void (*func)(),
52
53 if ( info == NULL )
54 {
55 -#ifdef __cplusplus
56 +#ifdef USE_CXX_VA_ELLIPSIS
57 ((void (*)(...))func)( GCI_PASSARGS( buf ) );
58 #else
59 ((void (*)())func)( GCI_PASSARGS( buf ) );