Repository navigation
fix(net): keep net_posix.c an empty TU when eNet is disabled - #103
Merged
srpatcha merged 1 commit intoSep 1, 2026
Merged
Conversation
Signed-off-by: Joonyoung Cho <fromochatime@gmail.com>
srpatcha
approved these changes
Sep 1, 2026
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
net/src/net_posix.cuses eNet types at file scope without an#if EOS_ENABLE_NETguard, whilenet/include/eos/net.hdeclares those types only whenEOS_ENABLE_NETis enabled.Because
EOS_ENABLE_NETdefaults to0and CMake still addsnet_posix.ctoeos_netfor non-cross builds, the default host build documented in the README fails to compile when networking is disabled.This includes the standard README build:
This PR wraps the implementation in
net_posix.cwith#if EOS_ENABLE_NET/#endif, following the existing pattern used bynet/src/net.c, and adds CI coverage for configurations that leave eNet disabled.Type of Change
Changes
net/src/net_posix.cto compile its implementation only whenEOS_ENABLE_NETis enabled, leaving an empty translation unit when networking is disabled.default-configCI job in.github/workflows/ci.ymlto build the default README configuration and selected product profiles where eNet is disabled.Testing
ctest --test-dir build/test --output-on-failure)Local test environment:
Default host build
The README build was configured and built successfully:
The build completed successfully through 100%.
Before the fix, the same configuration failed in
net/src/net_posix.cwith errors such as:The root cause is that these types are unavailable when
EOS_ENABLE_NET=0, whilenet_posix.cwas still being compiled.Test suite
Configured and built the test profile with:
Result:
Regression coverage
The bug is configuration-dependent rather than a runtime behavior that can be meaningfully exercised by a ctest case.
The new CI job therefore builds:
medicalproduct profile;aerospaceproduct profile.This ensures that configurations with
EOS_ENABLE_NETdisabled remain buildable.Pre-Submission Checklist
-Wall -Wextra -Werrorfor C)<type>(<scope>): <description>conventionRelated Issues
Related to #102, which applies a similar empty-translation-unit guard to
hal_linux.cunder a different feature/platform condition.This PR addresses the equivalent missing guard in
net_posix.c; it is a separate issue and does not close #102.Screenshots / Logs
Before the fix, the default configuration fails while compiling
net/src/net_posix.c:After the fix, the default README build completes successfully:
The test suite also completes successfully:
Additional Notes
The change does not alter networking behavior when
EOS_ENABLE_NET=1. It only prevents the POSIX networking implementation from referencing unavailable eNet types when the feature is disabled.The in-file guard follows the convention already used by
net/src/net.c. I intentionally did not change thetarget_sources()condition in CMake becauseEOS_ENABLE_NETis handled as a compile definition elsewhere, and keeping the guard at the source level is consistent with the existing implementation pattern.The local build produced several pre-existing compiler warnings in unrelated files, including warnings involving
strncpy,snprintf, ignored return values, and similar code. The build nevertheless completed successfully, and this PR does not modify those warning-producing code paths.