Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to C23, the default C standard in GCC 15 #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamesjer
Copy link
Contributor

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 declares f as a function returning values of type t with an unspecified parameter list. In C23, that declaration has the same meaning as t f(void);; i.e., it declares that f 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 type Int, but was declared with type unsigned long. The parameter of UpdateXCMDS has type Boolean, but was declared in xcmds.h to have type Int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant