Adding to what Paul Eggert wrote: > It looks like -Wc23-extensions is the problem. If you stop using it (or > if you also use -std=gnu23), you shouldn't get those warnings. At least, > that's the behavior I see with clang 18.1.6 (a bit later than your > clang) on Fedora. > > -Wc23-extensions is more trouble than it's worth when programs (as is > commonly the case) use C23 extensions only when available.
As written in the Gnulib manual [1]: "Many GCC warning options usually don’t point to mistakes in the code; these warnings enforce a certain programming style." You chose to desire warnings for C language constructs that are not yet contained in C 23. You got such warnings. Gnulib will not bow to your desired programming style, because it's not a programming style suitable for the future. But you can deactivate Gnulib's definition of _GL_ATTRIBUTE_NODISCARD by adding "-D_GL_ATTRIBUTE_NODISCARD=" to the CPPFLAGS or CFLAGS of your compilation. Bruno [1] https://www.gnu.org/software/gnulib/manual/html_node/manywarnings.html