Fix function prototype declarations for cross-platform compatibility#54
Merged
thiagoralves merged 1 commit intoDec 25, 2025
Merged
Conversation
- Fix close_unix_socket() signature mismatch: header declared with no parameters but implementation took int server_fd parameter - Update empty () declarations to (void) in headers and definitions for C standards compliance: - setup_unix_socket() - watchdog_init() - scan_cycle_time_start() - scan_cycle_time_end() - Update function pointer typedefs in plugin_driver.h to use (void) - Make store_on_buffer and retrieve_from_buffer static in log.c These changes ensure the code compiles on stricter compilers that treat -Wstrict-prototypes and -Wold-style-definition as errors. Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses compilation errors on strict C compilers by fixing function prototype mismatches and standardizing empty parameter lists to use (void) instead of () for C standards compliance.
Key changes:
- Fixed
close_unix_socketsignature mismatch between header declaration and implementation - Updated all empty parameter list declarations from
()to(void)across headers and implementations - Made internal logging buffer functions static to improve encapsulation
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/plc_app/utils/watchdog.h | Updated watchdog_init declaration to use (void) |
| core/src/plc_app/utils/watchdog.c | Updated watchdog_init definition to use (void) and reordered includes alphabetically |
| core/src/plc_app/utils/log.c | Made store_on_buffer and retrieve_from_buffer static, updated retrieve_from_buffer to use (void), and reformatted long lines |
| core/src/plc_app/unix_socket.h | Fixed close_unix_socket signature to accept int server_fd parameter and updated setup_unix_socket to use (void) |
| core/src/plc_app/unix_socket.c | Updated setup_unix_socket definition to use (void) |
| core/src/plc_app/scan_cycle_manager.h | Updated scan_cycle_time_start and scan_cycle_time_end declarations to use (void) |
| core/src/plc_app/scan_cycle_manager.c | Updated scan_cycle_time_start and scan_cycle_time_end definitions to use (void) |
| core/src/drivers/plugin_driver.h | Updated function pointer typedefs to use (void) for empty parameter lists |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Fixes a compilation error that occurs on some Linux distros with stricter compilers:
The root cause was
close_unix_socket()being declared with no parameters in the header but defined withint server_fdin the implementation. This PR fixes that mismatch and proactively updates other function declarations from()to(void)for C standards compliance.Changes:
close_unix_socketsignature mismatch inunix_socket.h()declarations to(void)in headers and definitions for:setup_unix_socket,watchdog_init,scan_cycle_time_start,scan_cycle_time_endplugin_driver.hto use(void)store_on_bufferandretrieve_from_bufferstatic in log.c (internal functions)Verified build passes with strict compiler flags:
-Wall -Wextra -Werror -Wstrict-prototypes -Wold-style-definitionReview & Testing Checklist for Human
close_unix_socket(int server_fd)signature in header matches the implementation (line 10 of unix_socket.h)plugin_driver.hRecommended test plan: Build and run the PLC runtime on the distro that was originally failing to confirm the compilation error is resolved.
Notes
Link to Devin run: https://app.devin.ai/sessions/6bc2817257fc4494aaa3e09ad67875f2
Requested by: Thiago Alves (@thiagoralves)