-
Notifications
You must be signed in to change notification settings - Fork 174
Fix build issues when compiling GAP with GCC 15 #6010
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
Conversation
Thanks for the patch. I adjusted the PR title to be useable for our user-facing release notes.
That's a red herring. do you know any non-exotic systems (i.e. no microcontrollers, no DOS/Windows 3.1, etc.) in current use where this is the case? In any case: For any architecture GAP runs on, this (every pointer fits into a
That is a true statement and why we have e.g. |
GCC 15/-std=c23: ``` src/bool.c:332:22: error: passing argument 1 of 'InitHandlerFunc' from incompatible pointer type [-Wincompatible-pointer-types] 332 | InitHandlerFunc( ReturnTrue1, "src/bool.c:ReturnTrue1" ); [ 19s] src/calls.h:416:30: note: expected ‘ObjFunc’ {aka ‘struct OpaqueBag * (*)(void)’} but argument is of type ‘struct OpaqueBag * (*)(struct OpaqueBag *, struct OpaqueBag *)’ ``` Declarators with unspecified arguments `int f();` got socially deprecated with C89; since then, one can write `f(void)` for actual zero-argument functions, and `f(T, ...)` for varargs functions. C23 finally yanked declarators with unspecified arguments. Different pointer types may have different size. So you can't have one pointer type for "all kinds of functions" in plain C. Nor C++ for that matter; some use of templates/RTTI would be necessary (possibly hidden in something like std::any, but still). Or rely on platform-specific extensions, e.g. POSIX>=2001 guarantees that sizeof(void*) >= sizeof(any function pointer) and that conversion is meaningful; this is effectively mandated by the presence of dlsym(). For Windows, sizeof(FARPROC) >= sizeof(afp), effectively mandated by GetProcAddress(). Fixes: gap-system#5857 gap-system#6009
Probably not: Flat addressing has been the norm since the 386.
"resp." is a mistranslation, so I removed it. |
OK, so this breaks C++ code in some GAP packages. That will have to be addressed before merging this. I'll trigger a package distro CI run against this branch to figure out which packages are affected. |
I agree we should just switch to void*, there is no way GAP would work on a platform where void* is a different size to a function pointer without significant cleanup. It's a shame there isn't a better way to fix this from a type-system point of view, but let's make sure it compiles everywhere. I have released a new profiling release (2.6.1) which should work with this PR once it is picked up, which will help with testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally all packages are passing 🎉
GCC 15/-std=c23:
Declarators with unspecified arguments
int f();
got socially deprecated with C89; since then, one can writef(void)
for actual zero-argument functions, andf(T, ...)
for varargs functions.C23 finally yanked declarators with unspecified arguments.
Different pointer types may have different size. So you can't have one pointer type for "all kinds of functions" in plain C. Nor C++ for that matter; some use of templates/RTTI would be necessary (possibly hidden in something like std::any, but still).
Or rely on platform-specific extensions, e.g. POSIX>=2001 guarantees that sizeof(void*) >= sizeof(any function pointer). This is what this patch does.
Fixes: #5857 #6009
Text for release notes
GCC 15 support