Fix function pointer type mismatches for GCC 15 compatibility #706
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.
Description
This PR fixes compilation errors when building nchan with GCC 15 (as used in Fedora 42+). GCC 15 has stricter type checking for function pointer assignments, which causes build failures with the current code.
Problem
When compiling with GCC 15.2.1, the following errors occur:
Solution
The fix involves ensuring all function pointers match their expected signatures:
longpoll.c & websocket.c: Split
empty_handler()into two properly typed functions:empty_subscriber_handler(subscriber_t *sub, void *data)for subscriber callbacksempty_cleanup_handler(void *data)for cleanup callbackseventsource.c: Changed
empty_handler(void)toempty_cleanup_handler(void *data)memstore_ipc.c & memstore.c: Changed
empty_callback()toempty_callback(ngx_int_t status, void *ptr1, void *ptr2)to match thecallback_pttypedefTesting
Compiles successfully with GCC 15.2.1 on Fedora 42, produces valid ngx_nchan_module.so (2.9MB shared object) with no compilation warnings or errors.
Important Note
This patch was developed with AI assistance. While it has been tested to compile successfully on the target system and the changes are straightforward type corrections, please review carefully for completeness, security implications, and compatibility with other GCC versions.
Files Changed
Related Issues
This addresses compilation failures on Fedora 42+ and other systems using GCC 15.