Skip to content

Commit e33035d

Browse files
cjihrigtargos
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.
1 parent 4e3d15d commit e33035d

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.8',
39+
'v8_embedder_string': '-node.9',
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
@@ -1830,7 +1830,17 @@ base::Optional<ParseResult> MakeNumberLiteralExpression(
18301830
// Meanwhile, we type it as constexpr float64 when out of int32 range.
18311831
double value = 0;
18321832
try {
1833+
#if defined(V8_OS_SOLARIS)
1834+
// stod() on Solaris does not currently support hex strings. Use strtol()
1835+
// specifically for hex literals until stod() support is available.
1836+
if (number.find("0x") || number.find("0X")) {
1837+
value = static_cast<double>(strtol(number.c_str(), nullptr, 0));
1838+
} else {
1839+
value = std::stod(number);
1840+
}
1841+
#else
18331842
value = std::stod(number);
1843+
#endif // !defined(V8_OS_SOLARIS)
18341844
} catch (const std::out_of_range&) {
18351845
Error("double literal out-of-range").Throw();
18361846
}

0 commit comments

Comments
 (0)