Switch integration flags to KCENON_WITH_* macros#336
Merged
Conversation
- Include feature_flags.h header in all integration entry points - Replace BUILD_WITH_THREAD_SYSTEM with KCENON_WITH_THREAD_SYSTEM - Replace BUILD_WITH_CONTAINER_SYSTEM with KCENON_WITH_CONTAINER_SYSTEM - Replace BUILD_WITH_MONITORING_SYSTEM with KCENON_WITH_MONITORING_SYSTEM - Replace BUILD_WITH_COMMON_SYSTEM with KCENON_WITH_COMMON_SYSTEM - Update comments to reference new macro names Part of #335: Align integration gating with unified flag contract
- Include feature_flags.h in all public headers - Replace BUILD_WITH_THREAD_SYSTEM with KCENON_WITH_THREAD_SYSTEM - Replace BUILD_WITH_CONTAINER_SYSTEM with KCENON_WITH_CONTAINER_SYSTEM - Replace BUILD_WITH_MONITORING_SYSTEM with KCENON_WITH_MONITORING_SYSTEM - Replace BUILD_WITH_COMMON_SYSTEM with KCENON_WITH_COMMON_SYSTEM - Update documentation comments to reference new macro names Part of #335: Align integration gating with unified flag contract
Update all target_compile_definitions() to use WITH_*_SYSTEM instead of BUILD_WITH_*. This allows feature_system_deps.h to properly detect and define KCENON_WITH_* macros. Changes: - BUILD_WITH_CONTAINER_SYSTEM -> WITH_CONTAINER_SYSTEM - BUILD_WITH_THREAD_SYSTEM -> WITH_THREAD_SYSTEM - BUILD_WITH_LOGGER_SYSTEM -> WITH_LOGGER_SYSTEM - BUILD_WITH_COMMON_SYSTEM -> WITH_COMMON_SYSTEM - BUILD_WITH_MONITORING_SYSTEM -> WITH_MONITORING_SYSTEM BUILD_WITH_* option() declarations are preserved for backward compatibility with existing build scripts. Part of #335: Align integration gating with unified flag contract
Update test files and verify_build.cpp to use feature_flags.h header and KCENON_WITH_* macros instead of BUILD_WITH_* macros for consistent feature detection across the codebase. - Add kcenon/common/config/feature_flags.h include - Replace BUILD_WITH_THREAD_SYSTEM with KCENON_WITH_THREAD_SYSTEM - Replace BUILD_WITH_CONTAINER_SYSTEM with KCENON_WITH_CONTAINER_SYSTEM - Replace BUILD_WITH_LOGGER_SYSTEM with KCENON_WITH_LOGGER_SYSTEM - Replace BUILD_MESSAGING_BRIDGE with KCENON_WITH_MESSAGING_BRIDGE Part of #335
Update documentation code examples to use KCENON_WITH_* macros instead of BUILD_WITH_* for feature detection in source code. CMake command-line options (-DBUILD_WITH_*) remain unchanged as they are user-facing configuration options. Updated files: - README.md, README_KO.md: Integration example - docs/INTEGRATION.md, docs/INTEGRATION_KO.md: Feature check examples - docs/FEATURES.md: Dual API support example - docs/API_REFERENCE_KO.md: Thread system adapter examples - docs/integration/with-common-system.md: Concepts integration - docs/integration/with-monitoring.md: Monitoring adapter example - docs/implementation/02-dependency-and-testing.md: Test examples Part of #335
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
Create network_system's own feature_flags.h that works both with and without common_system dependency: - When common_system is available (WITH_COMMON_SYSTEM defined), include common_system's feature_flags.h - When common_system is not available, define KCENON_WITH_* macros locally based on CMake definitions (WITH_*_SYSTEM) Update all source and header files to use the local feature_flags.h at <kcenon/network/config/feature_flags.h> instead of requiring common_system's header. This fixes standalone builds (Minimal Build) that were failing due to missing common_system headers. Part of #335
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
When thread_system is built with common_system, it uses KCENON_HAS_COMMON_EXECUTOR=1 which affects the class layout of thread_pool (conditional inheritance from IExecutor interface). network_system must define the same macro when including thread_system headers to ensure consistent class layout across compilation units. Without this, Windows MSVC fails with LNK2019 unresolved external symbol errors for thread_pool::is_running().
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
Update remaining code examples in documentation to use the new KCENON_WITH_* macro style instead of the old BUILD_WITH_* or #ifdef patterns, consistent with the codebase changes.
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
Fix ODR violation that caused ServerStartupOnUsedPort test to abort. The integration tests were defining BUILD_WITH_* macros but feature_flags.h only detects WITH_*_SYSTEM macros. This caused KCENON_WITH_COMMON_SYSTEM to be 0 in tests but 1 in the library, resulting in class layout mismatch (messaging_server has conditional members based on KCENON_WITH_COMMON_SYSTEM). Changes: - BUILD_WITH_COMMON_SYSTEM -> WITH_COMMON_SYSTEM - BUILD_WITH_LOGGER_SYSTEM -> WITH_LOGGER_SYSTEM - BUILD_WITH_THREAD_SYSTEM -> WITH_THREAD_SYSTEM - Add missing WITH_CONTAINER_SYSTEM This aligns integration tests with all other test CMakeLists.txt which already use WITH_*_SYSTEM macros.
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
Fix ODR violation that caused "corrupted size vs. prev_size" error on Ubuntu Debug and test failures on macOS Release. The integration_tests were using BUILD_WITH_* CMake options to determine compile definitions, but these don't always match the actual system availability detected by NetworkSystemIntegration.cmake. Changes: - Use *_SYSTEM_INCLUDE_DIR variables instead of BUILD_WITH_* options to detect actual system availability - Add KCENON_HAS_COMMON_EXECUTOR=1 when both thread_system and common_system are available (required for consistent thread_pool class layout) This aligns integration_tests compile definitions with the pattern used in tests/CMakeLists.txt and tests/integration/CMakeLists.txt. Part of #335
On macOS, localhost resolves to IPv6 (::1) first, then falls back to IPv4 (127.0.0.1) when the connection fails. This fallback process can take 5-10 seconds, causing test timeouts in CI environments. Changes: - Replace "localhost" with "127.0.0.1" in ConnectClient() - Replace "localhost" with "127.0.0.1" in ConnectAllClients() - Increase CI timeout from 2-3 seconds to 5 seconds for consistency This fixes ServerShutdownWithActiveConnections test failures on macOS Release builds. Part of #335
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
Add details about the ODR violation fix and macOS IPv6 delay fix to the KCENON_WITH_* feature flag unification section: - *_SYSTEM_INCLUDE_DIR pattern for consistent macro definitions - KCENON_HAS_COMMON_EXECUTOR for thread_pool class layout - 127.0.0.1 instead of localhost to avoid IPv6 fallback delays Part of #335
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
1 similar comment
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
When start_server() fails due to port binding errors (e.g., address already in use), previously created resources (io_context_, work_guard_) were not cleaned up. This caused heap corruption during object destruction. Changes: - Add resource cleanup in start_server() catch blocks to release partially created resources before returning error - Add explicit resource cleanup in destructor to handle cases where stop_server() returns early due to is_running_ being false This fixes "corrupted size vs. prev_size" errors in ConnectionLifecycleTest.ServerStartupOnUsedPort on Linux Debug builds.
Document the heap corruption fix in both English and Korean changelogs.
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
* refactor(integration): switch to KCENON_WITH_* macros in source files - Include feature_flags.h header in all integration entry points - Replace BUILD_WITH_THREAD_SYSTEM with KCENON_WITH_THREAD_SYSTEM - Replace BUILD_WITH_CONTAINER_SYSTEM with KCENON_WITH_CONTAINER_SYSTEM - Replace BUILD_WITH_MONITORING_SYSTEM with KCENON_WITH_MONITORING_SYSTEM - Replace BUILD_WITH_COMMON_SYSTEM with KCENON_WITH_COMMON_SYSTEM - Update comments to reference new macro names Part of #335: Align integration gating with unified flag contract * refactor(headers): switch to KCENON_WITH_* macros in header files - Include feature_flags.h in all public headers - Replace BUILD_WITH_THREAD_SYSTEM with KCENON_WITH_THREAD_SYSTEM - Replace BUILD_WITH_CONTAINER_SYSTEM with KCENON_WITH_CONTAINER_SYSTEM - Replace BUILD_WITH_MONITORING_SYSTEM with KCENON_WITH_MONITORING_SYSTEM - Replace BUILD_WITH_COMMON_SYSTEM with KCENON_WITH_COMMON_SYSTEM - Update documentation comments to reference new macro names Part of #335: Align integration gating with unified flag contract * build(cmake): switch compile definitions to WITH_*_SYSTEM Update all target_compile_definitions() to use WITH_*_SYSTEM instead of BUILD_WITH_*. This allows feature_system_deps.h to properly detect and define KCENON_WITH_* macros. Changes: - BUILD_WITH_CONTAINER_SYSTEM -> WITH_CONTAINER_SYSTEM - BUILD_WITH_THREAD_SYSTEM -> WITH_THREAD_SYSTEM - BUILD_WITH_LOGGER_SYSTEM -> WITH_LOGGER_SYSTEM - BUILD_WITH_COMMON_SYSTEM -> WITH_COMMON_SYSTEM - BUILD_WITH_MONITORING_SYSTEM -> WITH_MONITORING_SYSTEM BUILD_WITH_* option() declarations are preserved for backward compatibility with existing build scripts. Part of #335: Align integration gating with unified flag contract * test: switch to KCENON_WITH_* macros in test files Update test files and verify_build.cpp to use feature_flags.h header and KCENON_WITH_* macros instead of BUILD_WITH_* macros for consistent feature detection across the codebase. - Add kcenon/common/config/feature_flags.h include - Replace BUILD_WITH_THREAD_SYSTEM with KCENON_WITH_THREAD_SYSTEM - Replace BUILD_WITH_CONTAINER_SYSTEM with KCENON_WITH_CONTAINER_SYSTEM - Replace BUILD_WITH_LOGGER_SYSTEM with KCENON_WITH_LOGGER_SYSTEM - Replace BUILD_MESSAGING_BRIDGE with KCENON_WITH_MESSAGING_BRIDGE Part of #335 * docs: update code examples to use KCENON_WITH_* macros Update documentation code examples to use KCENON_WITH_* macros instead of BUILD_WITH_* for feature detection in source code. CMake command-line options (-DBUILD_WITH_*) remain unchanged as they are user-facing configuration options. Updated files: - README.md, README_KO.md: Integration example - docs/INTEGRATION.md, docs/INTEGRATION_KO.md: Feature check examples - docs/FEATURES.md: Dual API support example - docs/API_REFERENCE_KO.md: Thread system adapter examples - docs/integration/with-common-system.md: Concepts integration - docs/integration/with-monitoring.md: Monitoring adapter example - docs/implementation/02-dependency-and-testing.md: Test examples Part of #335 * fix: add local feature_flags.h for standalone builds Create network_system's own feature_flags.h that works both with and without common_system dependency: - When common_system is available (WITH_COMMON_SYSTEM defined), include common_system's feature_flags.h - When common_system is not available, define KCENON_WITH_* macros locally based on CMake definitions (WITH_*_SYSTEM) Update all source and header files to use the local feature_flags.h at <kcenon/network/config/feature_flags.h> instead of requiring common_system's header. This fixes standalone builds (Minimal Build) that were failing due to missing common_system headers. Part of #335 * fix(cmake): add KCENON_HAS_COMMON_EXECUTOR for thread_system integration When thread_system is built with common_system, it uses KCENON_HAS_COMMON_EXECUTOR=1 which affects the class layout of thread_pool (conditional inheritance from IExecutor interface). network_system must define the same macro when including thread_system headers to ensure consistent class layout across compilation units. Without this, Windows MSVC fails with LNK2019 unresolved external symbol errors for thread_pool::is_running(). * docs: update code examples to use KCENON_WITH_* macros Update remaining code examples in documentation to use the new KCENON_WITH_* macro style instead of the old BUILD_WITH_* or #ifdef patterns, consistent with the codebase changes. * fix(cmake): use WITH_*_SYSTEM macros in integration tests Fix ODR violation that caused ServerStartupOnUsedPort test to abort. The integration tests were defining BUILD_WITH_* macros but feature_flags.h only detects WITH_*_SYSTEM macros. This caused KCENON_WITH_COMMON_SYSTEM to be 0 in tests but 1 in the library, resulting in class layout mismatch (messaging_server has conditional members based on KCENON_WITH_COMMON_SYSTEM). Changes: - BUILD_WITH_COMMON_SYSTEM -> WITH_COMMON_SYSTEM - BUILD_WITH_LOGGER_SYSTEM -> WITH_LOGGER_SYSTEM - BUILD_WITH_THREAD_SYSTEM -> WITH_THREAD_SYSTEM - Add missing WITH_CONTAINER_SYSTEM This aligns integration tests with all other test CMakeLists.txt which already use WITH_*_SYSTEM macros. * docs: add CHANGELOG entries for KCENON_WITH_* feature flag unification Document the feature flag changes made in PR #336: - Switch from BUILD_WITH_* to KCENON_WITH_* macros - Add feature_flags.h for unified feature detection - Fix ODR violation in integration tests Closes #335 * fix(cmake): use *_SYSTEM_INCLUDE_DIR for integration test definitions Fix ODR violation that caused "corrupted size vs. prev_size" error on Ubuntu Debug and test failures on macOS Release. The integration_tests were using BUILD_WITH_* CMake options to determine compile definitions, but these don't always match the actual system availability detected by NetworkSystemIntegration.cmake. Changes: - Use *_SYSTEM_INCLUDE_DIR variables instead of BUILD_WITH_* options to detect actual system availability - Add KCENON_HAS_COMMON_EXECUTOR=1 when both thread_system and common_system are available (required for consistent thread_pool class layout) This aligns integration_tests compile definitions with the pattern used in tests/CMakeLists.txt and tests/integration/CMakeLists.txt. Part of #335 * fix(test): use 127.0.0.1 instead of localhost to avoid IPv6 delays On macOS, localhost resolves to IPv6 (::1) first, then falls back to IPv4 (127.0.0.1) when the connection fails. This fallback process can take 5-10 seconds, causing test timeouts in CI environments. Changes: - Replace "localhost" with "127.0.0.1" in ConnectClient() - Replace "localhost" with "127.0.0.1" in ConnectAllClients() - Increase CI timeout from 2-3 seconds to 5 seconds for consistency This fixes ServerShutdownWithActiveConnections test failures on macOS Release builds. Part of #335 * docs: update CHANGELOG with ODR and IPv6 fix details Add details about the ODR violation fix and macOS IPv6 delay fix to the KCENON_WITH_* feature flag unification section: - *_SYSTEM_INCLUDE_DIR pattern for consistent macro definitions - KCENON_HAS_COMMON_EXECUTOR for thread_pool class layout - 127.0.0.1 instead of localhost to avoid IPv6 fallback delays Part of #335 * fix(server): prevent heap corruption when start_server fails When start_server() fails due to port binding errors (e.g., address already in use), previously created resources (io_context_, work_guard_) were not cleaned up. This caused heap corruption during object destruction. Changes: - Add resource cleanup in start_server() catch blocks to release partially created resources before returning error - Add explicit resource cleanup in destructor to handle cases where stop_server() returns early due to is_running_ being false This fixes "corrupted size vs. prev_size" errors in ConnectionLifecycleTest.ServerStartupOnUsedPort on Linux Debug builds. * docs: add changelog entries for messaging_server resource cleanup fix Document the heap corruption fix in both English and Korean changelogs.
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
This PR implements issue #335 by switching integration flags from
BUILD_WITH_*toKCENON_WITH_*macros for consistent feature detection across the codebase.Changes Made
Source Files - Added
#include <kcenon/common/config/feature_flags.h>and replacedBUILD_WITH_*withKCENON_WITH_*macros:src/integration/*.cppsrc/core/*.cppsrc/network_system.cppsrc/metrics/network_metrics.cppHeader Files - Same changes applied to:
include/kcenon/network/integration/*.hinclude/kcenon/network/core/*.hinclude/kcenon/network/concepts/*.hinclude/kcenon/network/utils/*.hinclude/kcenon/network/di/*.hinclude/kcenon/network/compatibility.hCMake Files - Changed
target_compile_definitions()fromBUILD_WITH_*toWITH_*_SYSTEM:cmake/NetworkSystemIntegration.cmakeCMakeLists.txttests/CMakeLists.txtand subdirectoriesbenchmarks/CMakeLists.txtsamples/messaging_system_integration/CMakeLists.txtTest Files - Updated test files with feature_flags.h and KCENON_WITH_* macros:
tests/unit/test_thread_system_adapter.cpptests/integration/test_compatibility.cppverify_build.cppDocumentation - Updated code examples to use
KCENON_WITH_*macros:How It Works
BUILD_WITH_*(e.g.,-DBUILD_WITH_THREAD_SYSTEM=ON)WITH_*_SYSTEM(e.g.,WITH_THREAD_SYSTEM)feature_system_deps.hdetects these definitions and setsKCENON_WITH_*macros#if KCENON_WITH_*for feature detectionBenefits
feature_flags.hentry pointTest plan
-DBUILD_WITH_THREAD_SYSTEM=ON -DBUILD_WITH_CONTAINER_SYSTEM=ON -DBUILD_WITH_LOGGER_SYSTEM=ON-DBUILD_WITH_THREAD_SYSTEM=OFF -DBUILD_WITH_CONTAINER_SYSTEM=OFFctest --output-on-failureCloses #335