Skip to content

Conversation

@swiftnav-svc-jenkins
Copy link
Collaborator

Automated PR by Jenkins. If CI has passed successfully, merge away!

cmake 1ab487a2 -> d5558e3a

This pull request was created by https://jenkins.ci.swift-nav.com/job/CI%20Infra/job/submodule-update/21558/.

# Issue

The check unit testing framework (used as a third-party dependency)
emits compiler diagnostics that break the build on Windows platforms,
even though it's configured as an external dependency with
`SYSTEM_INCLUDES`.

Specific error:
``` 
D:\a\libsbp\libsbp\c\third_party\check\lib\timer_delete.c:48:5: error: implicit declaration of function 'alarm' [-Wimplicit-function-declaration]
```

# Root Cause

The check library has platform compatibility issues on Windows:

1. Missing POSIX functions: Windows lacks POSIX functions like alarm(),
setitimer(), and proper timer support
2. Incomplete fallback detection: While check includes compatibility
shims (e.g., alarm.c), the file timer_delete.c calls alarm() directly
without proper header inclusion or declaration checking
3. SYSTEM_INCLUDES limitation: The SYSTEM_INCLUDES flag in CMake only
suppresses warnings from headers consumed via
target_include_directories(). However, check adds its compatibility
source files (including timer_delete.c) directly to the target via
target_sources(), so these files are compiled as part of the target
itself and inherit all parent compile flags including -Werror

Note: The check project has been unmaintained for over 4 years (last
release: 0.15.2 in 2020), making an upstream fix unlikely.

# Solution

Modified cmake/common/FindCheck.cmake to temporarily adjust
CMAKE_C_FLAGS during the check library's configuration and compilation:

1. Save original flags before including the dependency
2. Apply platform-specific suppressions:
- MinGW/GCC: Remove -Werror and add
-Wno-error=implicit-function-declaration
- MSVC: Remove /WX and add /wd4013 (disables C4013: implicit function
declaration)
3. Restore original flags immediately after the dependency is added

This approach:
 - ✅ Doesn't modify third-party code
 - ✅ Only affects check library compilation
 - ✅ Preserves strict warnings for project code
 - ✅ Supports both MinGW and MSVC toolchains

Triggered-By:	cmake	d5558e3ad3c2cdabfb1ba31d20ea4defce570a95
Upstream-PR:	http://github.com/swift-nav/cmake/pull/188
@sonarqubecloud
Copy link

@martin4861 martin4861 merged commit 4220745 into master Oct 15, 2025
23 checks passed
@martin4861 martin4861 deleted the auto-submodule-pointer-update/id-d5558e3ad3 branch October 15, 2025 16:52
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.

4 participants