bvi fails to build with gcc-15/C23
Brought to you by:
buergmann
Hi Gerhard,
As initially identified in Debian bug #1096399, see [1], bvi
fails to build with a big number of errors related to number of
arguments not matching prototypes with gcc-15. Here is an excerpt of the
build log, I have uploaded a complete log some place else[2] as
it shows a lot lot more of the same kind of issues:
gcc -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/bvi-1.4.2=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DHAVE_CONFIG_H -c set.c
set.c: In function ‘doset’:
set.c:69:1: warning: old-style function definition [-Wold-style-definition]
69 | doset(arg)
| ^~~~~
set.c:71:1: error: number of arguments doesn’t match prototype
71 | {
| ^
In file included from set.c:34:
bvi.h:277:25: error: prototype declaration
277 | int doset();
| ^~~~~
set.c:79:17: error: too many arguments to function ‘showparms’; expected 0, have 1
79 | showparms(FALSE);
| ^~~~~~~~~ ~~~~~
bvi.h:296:17: note: declared here
296 | void showparms(), toggle(), scrolldown(), scrollup();
| ^~~~~~~~~
set.c:83:17: error: too many arguments to function ‘showparms’; expected 0, have 1
83 | showparms(TRUE);
| ^~~~~~~~~ ~~~~
bvi.h:296:17: note: declared here
296 | void showparms(), toggle(), scrolldown(), scrollup();
| ^~~~~~~~~
set.c:110:25: error: too many arguments to function ‘msg’; expected 0, have 1
110 | msg(buf);
| ^~~ ~~~
bvi.h:294:28: note: declared here
294 | void setpage(), msg(), emsg(), smsg();
| ^~~
set.c:114:25: error: too many arguments to function ‘emsg’; expected 0, have 1
114 | emsg("Can't change type of terminal from within bvi");
| ^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bvi.h:294:35: note: declared here
294 | void setpage(), msg(), emsg(), smsg();
| ^~~~
[…]
The root cause looks to be that gcc-15 moved to C23 by default,
where the meaning of functions declarations without parameters
changed from "unspecified" to "void", see the porting guide[3].
I take "drop to C17 or earlier" as a valid answer, but I thought
that you would want to be at least aware of the problem.
Have a nice day, :)
Étienne.
Links look to have dropped off the ticket.
They were supposed to be:
1: https://bugs.debian.org/1096399
2: https://people.debian.org/~emollier/logs/bvi/bvi_1.4.2-3_amd64.build
3: https://gcc.gnu.org/gcc-15/porting_to.html
Good day,
I had a closer look at the errors and found out the Debian build
branches to function prototypes with unspecified argument types,
but there exists also function prototypes with specified
argument types when the ANSI macro is defined for most
functions. If I ensure that the build branches to typed
arguments in every cases, then it builds fine with -stdc=gnu23;
this also does not introduce regressions with -stdc=gnu89.
I plan to use the patch in attachment which relies on STDC
to implement the split between the two types of function
prototypes to get my builds to go through with gnu23 standard C.
Maybe it can be useful upstream too?
Have a nice day, :)
Étienne.
Fixed in 1.5.0
Great! Thank you!
Debian 13 trixie entered full freeze today and is planned to be released on August 9th, so I'll integrate bvi 1.5.0 in Debian unstable after that date.
Have a nice day, :)
Étienne.