Draft
Fix incompatible function pointer types error in sed_property.c#20
Conversation
Author
|
@mcflugen 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: mcflugen <6618196+mcflugen@users.noreply.github.com>
Co-authored-by: mcflugen <6618196+mcflugen@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Build stops with incompatible function pointer types error
Fix incompatible function pointer types error in sed_property.c
Sep 11, 2025
|
Wow, that's pretty cool. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes the build error that occurs on macOS (and other systems with strict compiler warnings) where incompatible function pointer types cause compilation to fail.
The issue was in
ew/sed/sed_property.clines 110, 114, 118, 122, 126, 130, and 134. These lines were initializing union fields incorrectly - they cast function pointers to the correct type but the union initialization was defaulting to the first field (f_0) instead of the appropriate field for functions with different signatures.For example, the original problematic code:
{ "shear_strength", "sheer", {(Sed_cell_property_func_1)(sed_cell_shear_strength)}, 2 },Was trying to initialize
f_0(which expectsdouble (*)(const Sed_cell)) with a function that has signaturedouble (*)(const Sed_cell, double), causing the incompatible pointer types error.Changes made:
.f_1 = function_name) to specify the correct union field for functions that take 2 parameters (cell + 1 additional parameter)&) where they weren't needed.gitignoreto prevent build artifacts from being committedAfter the fix:
{ "shear_strength", "sheer", {.f_1 = sed_cell_shear_strength}, 2 },Now correctly initializes the
f_1field of the union, which matches the function signature.The fix is minimal and surgical, preserving all existing functionality while resolving the compilation errors. Build now succeeds even with
-Werror=incompatible-pointer-typesand all property functions work correctly.Fixes #19.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.