ghostscript-10.04.0 fails to build with upcoming GCC 15 that defaults to C23 (-std=gnu23). Originally reported downstream in Gentoo at https://bugs.gentoo.org/943857. In this case, the issue is that `bool` becomes a proper identifier without any includes required: ``` x86_64-pc-linux-gnu-gcc -O2 -DNDEBUG -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DHAVE_SNPRINTF -O2 -pipe -march=native -fno-diagnostics-color -DHAVE_RESTRICT=1 -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -I./base -o ./obj/aux/genarch ./base/genarch.c -lm -ldl -lidn -lpaper -ltiff -rdynamic -lfontconfig -lfreetype -lfreetype -lopenjp2 -lz In file included from ./base/genarch.c:22: ./base/stdpre.h:348:13: error: two or more data types in declaration specifiers 348 | typedef int bool; | ^~~~ ./base/stdpre.h:348:1: warning: useless type name in empty declaration 348 | typedef int bool; | ^~~~~~~ make: *** [base/unix-aux.mak:68: obj/aux/genarch] Error 1 ``` i.e. the typedef is currently redeclaring bool when it's now a builtin type, so that can't be done.
It's very irritating that they would default to a standard that's been published for less than a month. And it's extremely irritating that one of the premier open source projects is defaulting to a standard only available from a (not cheap) paywalled organisation. :-( I'll look at this at some point.
Created attachment 26351 [details] patch for C23 compliance ghostpdl programs can be tweaked to compile by the current gcc with a few minor changes. The resulting gs executable passed a smoke test, but it has not been tested thoroughly. I did not fix compiler warnings, such as applying operators ++ or -- to boolean variables. In case of conflicts between function definitions and declarations, the choice between int and bool is not always obvious. I can continue to work in this bug, fix compiler warnings and look deeper into the distinction between boolean values and integer return codes, providing that there's interest on Artifex part.
*** Bug 708290 has been marked as a duplicate of this bug. ***