Repository navigation
util: Port os_strtod and os_dtostr to obs-util - #826
Merged
Merged
Conversation
zackees
force-pushed
the
port/platform-number-rust
branch
from
October 15, 2026 13:35
11e20a9 to
3778584
Compare
zackees
marked this pull request as ready for review
October 15, 2026 13:41
Member
Author
|
Rust Tests failed on Linux and Windows: the new Tier 1 test |
Tier 1 ports test_strtod, test_dtostr and test_dtostr_exponent through new os_strtod/os_dtostr shims over todo!() cores. Tier 3 compares them with the real platform-number.c compiled as an oracle; the oracle's config-file now uses that file instead of its own copies (#145). ENABLE_RUST_LIBOBS=ON drops platform-number.c. Refs #262
The strtod parser and %.17g formatter move out of config_file.rs into platform_number.rs, which now backs both the os_strtod/os_dtostr shims and config_get_double/config_set_double. os_dtostr applies C's buffer size checks, including measuring before the exponent is shortened. Refs #262
Like the other Tier 1 tests, it needs the oracle's test allocator and log stubs; the windows-gnu link failed without them. Refs #262
zackees
force-pushed
the
port/platform-number-rust
branch
from
October 15, 2026 14:25
6c75aab to
9e5dff0
Compare
Member
Author
|
#825 merged; rebased onto master (dropped the extraction commit, replaced head 9f… with the three port commits only) and removed the stacked note. |
Member
Author
|
Correction to the comment above: the replaced head is |
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.
Refs #262 (slice 2, numbers).
RED (
util: Test os_strtod and os_dtostr against Rust stubs):rust/obs-util/src/platform_number.rswithtodo!()cores and C ABI shims inffi/platform_number.rs.tests/platform_number.rs): 1:1 ports oftest_strtod,test_dtostrandtest_dtostr_exponent. Aborts ontodo!("os_dtostr port (#262)").tests/platform_number_parity.rs): edge values, every buffer size 0–71 and proptest over allf64bit patterns and number-like strings, against the realplatform-number.ccompiled asoracle_*. The oracle's config-file now links that file instead of the copies inconfig_file_host.c(one fewer drifting stand-in, bug: Oracle stand-ins in test_stubs.c can diverge from libobs #145).ENABLE_RUST_LIBOBS=ONdropsutil/platform-number.c; exports inrust-exports.d/obs-util-platform_number.txt.GREEN (
util: Port os_strtod and os_dtostr to obs-util): the existingstrtodparser and%.17gformatter move out ofconfig_file.rsintoplatform_number.rs, which now backs both the shims andconfig_get_double/config_set_double.os_dtostrapplies C's size checks exactly (measured before the exponent is shortened;.0needslength + 3 < size).Locally:
soldr cargo test -p obs-utilall green,./lintok. Mutation check: changing the.0check to+ 2failsdtostr_edge_values. Tier 2 OFF/ON is left to PR CI.Intentional difference, documented on the shims: C swaps
.for theLC_NUMERICdecimal point; Rust always uses.. Only a string already written with the locale's own point ("1,5"under a,locale) reads differently.