Skip to content

Commit 2b7fa3a

Browse files
cjihrigryzokuken
authored andcommitted
deps: workaround stod() limitations on SmartOS
std::stod() on SmartOS does not currently handle hex strings. This commit provides a workaround based on strtol() until proper stod() support is available. PR-URL: #37330 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent b467584 commit 2b7fa3a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.7',
39+
'v8_embedder_string': '-node.8',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/torque/torque-parser.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,17 @@ base::Optional<ParseResult> MakeNumberLiteralExpression(
18341834
// Meanwhile, we type it as constexpr float64 when out of int32 range.
18351835
double value = 0;
18361836
try {
1837+
#if defined(V8_OS_SOLARIS)
1838+
// stod() on Solaris does not currently support hex strings. Use strtol()
1839+
// specifically for hex literals until stod() support is available.
1840+
if (number.find("0x") || number.find("0X")) {
1841+
value = static_cast<double>(strtol(number.c_str(), nullptr, 0));
1842+
} else {
1843+
value = std::stod(number);
1844+
}
1845+
#else
18371846
value = std::stod(number);
1847+
#endif // !defined(V8_OS_SOLARIS)
18381848
} catch (const std::out_of_range&) {
18391849
Error("double literal out-of-range").Throw();
18401850
}

0 commit comments

Comments
 (0)