Repository navigation
build: Convert HAS_TIME_T_UNSIGNED to a compile-time check - #22849
Closed
tyler-yankee wants to merge 1 commit into
Closed
tyler-yankee wants to merge 1 commit into
tyler-yankee wants to merge 1 commit into
Conversation
`(time_t)-1 > 0` is a constant expression. Checking this at compile time instead of running a program (a) is faster, and (b) can be checked when cross-compiling. Suggested-by: Florent Castelli <florent@engflow.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change replaces runtime probes with equivalent compile-time assertions in both Autoconf and CMake without introducing behavioral risk to the produced binaries.
Pull request overview
This PR updates curl’s build-time feature detection for HAVE_TIME_T_UNSIGNED to use compile-time (non-executed) checks, improving speed and enabling correct detection while cross-compiling.
Changes:
- Autoconf: replace the runtime
CURL_RUN_IFELSEprobe with anAC_COMPILE_IFELSEcompile-time assertion. - CMake: replace
check_c_source_runs()withcurl_internal_test(HAVE_TIME_T_UNSIGNED)usingtry_compile. - Add a corresponding compile-time assertion test block to
CMake/CurlTests.c.
File summaries
| File | Description |
|---|---|
| configure.ac | Switches time_t unsignedness detection to a compile-time check (works for cross-compiling). |
| CMakeLists.txt | Routes HAVE_TIME_T_UNSIGNED detection through curl’s internal try_compile-based test framework. |
| CMake/CurlTests.c | Adds the compile-time assertion used by curl_internal_test(HAVE_TIME_T_UNSIGNED). |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
Thanks! |
vszakats
added a commit
that referenced
this pull request
Sep 30, 2026
- autotools: sync LibreSSL detection with rest of forks. - CMakeLists.txt: say `time_t` sign is pre-fill (for amiga/dos), auto-detection also works now. Follow-up to 2f1a21b #22849 - urldata.h: drop redundant parentheses from macro values. - curl_setup.h, libssh.c: fix indent. - GHA/windows: update comment. - GHA/windows: update Cygwin package search URL. - GHA/linux: drop curl build option from LibreSSL configure line. - GHA: sync option order between workflows. - docs/INSTALL.md: mention missing AWS-LC in comment. - test804: add newline for readability. - OS400: clang-format. - docs, lib: drop spaces after cast. Credits-to: Patrick Monnerat Ref: #22729 - tests/memanalyzer.pm: move literal to right-side of comparison. - drop `v` prefix from version numbers in docs, where missing. - minor whitespace fixes. Closes #23146
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.
(time_t)-1 > 0is a constant expression. Checking this at compile time instead of running a program (a) is faster, and (b) can be checked when cross-compiling.