Skip to content

Fix incompatible function pointer types error in sed_property.c#20

Draft
mcflugen with Copilot wants to merge 3 commits into
developfrom
copilot/fix-19
Draft

Fix incompatible function pointer types error in sed_property.c#20
mcflugen with Copilot wants to merge 3 commits into
developfrom
copilot/fix-19

Conversation

Copilot AI commented Sep 11, 2025

Copy link
Copy Markdown

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.c lines 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 expects double (*)(const Sed_cell)) with a function that has signature double (*)(const Sed_cell, double), causing the incompatible pointer types error.

Changes made:

  • Used C99 designated initializers (.f_1 = function_name) to specify the correct union field for functions that take 2 parameters (cell + 1 additional parameter)
  • Removed unnecessary ampersand operators (&) where they weren't needed
  • Added build directories to .gitignore to prevent build artifacts from being committed

After the fix:

{
    "shear_strength", "sheer",
    {.f_1 = sed_cell_shear_strength}, 2
},

Now correctly initializes the f_1 field 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-types and 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
    • Triggering command: /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.

Copilot AI self-assigned this Sep 11, 2025

Copilot AI commented Sep 11, 2025

Copy link
Copy Markdown
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.

Copilot AI and others added 2 commits September 11, 2025 23:31
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
Copilot AI requested a review from mcflugen September 11, 2025 23:39
@mdpiper

mdpiper commented Sep 11, 2025

Copy link
Copy Markdown

Wow, that's pretty cool.

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.

Build stops with incompatible function pointer types error

3 participants