Adapt to C23, the default C standard in GCC 15 #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Fedora project is currently building all packages with a GCC 15 prerelease. This version of GCC changes the default C standard from C17 to C23. One major change in C23 is that the declarations of the form
t f();
have changed semantics. In C17 and earlier, that declaresf
as a function returning values of typet
with an unspecified parameter list. In C23, that declaration has the same meaning ast f(void);
; i.e., it declares thatf
takes no parameters. This change led to many compile-time errors when building xgap.This PR adds explicit parameter lists as needed. Also, the code had a mix of K&R and ANSI style function definitions. This PR also converts the remaining K&R style definitions to ANSI style, thus avoiding a large number of warnings from GCC. One side effect is that all signal handlers are now declared to take an
int
parameter, whether it is used or not. In C23, one can add[[maybe_unused]]
attributes, but that won't work for all extant compilers so I have left it out.Two explicit declarations of
errno
were removed. Those declarations are wrong. On modern systems,errno
is a thread-specific value, but the removed declarations lack the appropriate thread-specific attribute.This work did turn up some cases where types were mismatched. The last parameter of
GapSrcReadText
should have typeInt
, but was declared with typeunsigned long
. The parameter ofUpdateXCMDS
has typeBoolean
, but was declared inxcmds.h
to have typeInt
.