Hi Camm, Yes, master builds successfully with GCC 15 if -std=gnu17 is in CFLAGS. The GCC 15 change to C23 as default has been very disruptive, but I think the dust is finally starting to settle somewhat.
On Fri, Feb 21, 2025 at 8:42 AM Camm Maguire <c...@maguirefamily.org> wrote: > > Greetings! I'm wondering if you might confirm that current master > builds with just the same -std=gnu17 in CFLAGS? Debian is moving to > gcc-15 too but the compiler is not yet installable in any chroot. > > Take care, > > Jerry James <loganje...@gmail.com> writes: > > > Greetings, > > > > The Fedora project is rebuilding all packages with a prerelease of GCC > > 15. This version of GCC changes the default C standard from C17 to > > C23. Two C23 changes have been causing a lot of build failures, and > > also affect gcl. > > > > First, "bool", "true", and "false" are now keywords of the language; > > i.e., "#include <stdbool.h>" has become a no-op. One consequence is > > that this code in h/lu.h is now illegal: > > > > #undef bool > > typedef int bool; > > > > Since bool is a language keyword, not a preprocessor macro, the #undef > > has no effect, and you can't create a typedef for a builtin type, so > > that is a compiler error. (There is another such typedef in > > bin/dpp.c.) > > > > Second, in C17 and earlier, function declarations of the form "t f();" > > mean that f is a function that returns type t and has an unspecified > > parameter list. In C23, such a declaration has the same meaning as "t > > f(void);"; i.e., it asserts that f takes zero arguments. This leads > > to build errors like this: > > > > In file included from ../h/include.h:119, > > from typespec.c:29: > > ../h/../h/protoize.h:64:41: error: conflicting types for > > ‘clear_compiler_properties’; have ‘union lispunion *(union lispunion > > *, union lispunion *)’ > > 64 | /* assignment.c:547:OF */ extern object > > clear_compiler_properties (object sym, object code); /* (sym, code) > > object sym; object code; */ > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > In file included from ../h/include.h:112: > > ../h/../h/object.h:532:8: note: previous declaration of > > ‘clear_compiler_properties’ with type ‘union lispunion *(void)’ > > 532 | object clear_compiler_properties(); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > > > I attempted to work around the issue for now by adding -std=gnu17 to > > the build flags, but that still fails: > > > > ../bin/dpp.c:84:13: error: ‘bool’ cannot be defined via ‘typedef’ > > 84 | typedef int bool; > > | ^~~~ > > ../bin/dpp.c:84:13: note: ‘bool’ is a keyword with ‘-std=c23’ onwards > > ../bin/dpp.c:84:1: warning: useless type name in empty declaration > > 84 | typedef int bool; > > | ^~~~~~~ > > > > The problem is that the C compiler is invoked without user CFLAGS in 3 > > places, each time defaulting to C23 mode. The attached patch, plus > > explicitly specifying the C standard as C17 or earlier, works around > > the issue. > > -- > > Jerry James > > http://www.jamezone.org/ > > > > > > -- > Camm Maguire c...@maguirefamily.org > ========================================================================== > "The earth is but one country, and mankind its citizens." -- Baha'u'llah -- Jerry James http://www.jamezone.org/