Commit e80779d2 authored by Peter Kasting's avatar Peter Kasting Committed by V8 LUCI CQ

Fixes for C++20 mode.

* "volatile" on by-value params is deprecated.  Remove.
* ICU has decided not to fix a warning about rewritten comparison
  operators.  Work around.  This is ugly, but the alternative is
  disabling the warning entirely for this file or all of v8, which seem
  worse.

Bug: chromium:1284275
Change-Id: Ia90ae439fc56c3970da539d4ae3a64927ec4357b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3652575
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80631}
parent 8dcc6f81
...@@ -76,7 +76,7 @@ class WasmGraphAssembler : public GraphAssembler { ...@@ -76,7 +76,7 @@ class WasmGraphAssembler : public GraphAssembler {
Node* Branch(Node* cond, Node** true_node, Node** false_node, Node* Branch(Node* cond, Node** true_node, Node** false_node,
BranchHint hint); BranchHint hint);
Node* NumberConstant(volatile double value) { Node* NumberConstant(double value) {
return graph()->NewNode(mcgraph()->common()->NumberConstant(value)); return graph()->NewNode(mcgraph()->common()->NumberConstant(value));
} }
......
...@@ -32,6 +32,10 @@ namespace internal { ...@@ -32,6 +32,10 @@ namespace internal {
namespace { namespace {
// This is to work around ICU's comparison operators not being compliant with
// clang's -Wambiguous-reversed-operator in >=C++20.
#define AVOID_AMBIGUOUS_OP_WARNING(x) *static_cast<icu::UObject*>(&x)
// [[Style]] is one of the values "decimal", "percent", "currency", // [[Style]] is one of the values "decimal", "percent", "currency",
// or "unit" identifying the style of the number format. // or "unit" identifying the style of the number format.
enum class Style { DECIMAL, PERCENT, CURRENCY, UNIT }; enum class Style { DECIMAL, PERCENT, CURRENCY, UNIT };
...@@ -300,7 +304,7 @@ Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> IsWellFormedUnitIdentifier( ...@@ -300,7 +304,7 @@ Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> IsWellFormedUnitIdentifier(
icu::MeasureUnit none = icu::MeasureUnit(); icu::MeasureUnit none = icu::MeasureUnit();
// 1. If the result of IsSanctionedUnitIdentifier(unitIdentifier) is true, // 1. If the result of IsSanctionedUnitIdentifier(unitIdentifier) is true,
// then // then
if (result != none) { if (result != AVOID_AMBIGUOUS_OP_WARNING(none)) {
// a. Return true. // a. Return true.
std::pair<icu::MeasureUnit, icu::MeasureUnit> pair(result, none); std::pair<icu::MeasureUnit, icu::MeasureUnit> pair(result, none);
return Just(pair); return Just(pair);
...@@ -319,7 +323,7 @@ Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> IsWellFormedUnitIdentifier( ...@@ -319,7 +323,7 @@ Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> IsWellFormedUnitIdentifier(
// 4. If the result of IsSanctionedUnitIdentifier(numerator) is false, then // 4. If the result of IsSanctionedUnitIdentifier(numerator) is false, then
result = IsSanctionedUnitIdentifier(numerator); result = IsSanctionedUnitIdentifier(numerator);
if (result == none) { if (result == AVOID_AMBIGUOUS_OP_WARNING(none)) {
// a. Return false. // a. Return false.
return Nothing<std::pair<icu::MeasureUnit, icu::MeasureUnit>>(); return Nothing<std::pair<icu::MeasureUnit, icu::MeasureUnit>>();
} }
...@@ -329,7 +333,7 @@ Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> IsWellFormedUnitIdentifier( ...@@ -329,7 +333,7 @@ Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> IsWellFormedUnitIdentifier(
// 6. If the result of IsSanctionedUnitIdentifier(denominator) is false, then // 6. If the result of IsSanctionedUnitIdentifier(denominator) is false, then
icu::MeasureUnit den_result = IsSanctionedUnitIdentifier(denominator); icu::MeasureUnit den_result = IsSanctionedUnitIdentifier(denominator);
if (den_result == none) { if (den_result == AVOID_AMBIGUOUS_OP_WARNING(none)) {
// a. Return false. // a. Return false.
return Nothing<std::pair<icu::MeasureUnit, icu::MeasureUnit>>(); return Nothing<std::pair<icu::MeasureUnit, icu::MeasureUnit>>();
} }
...@@ -1388,10 +1392,10 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1388,10 +1392,10 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
icu::MeasureUnit none = icu::MeasureUnit(); icu::MeasureUnit none = icu::MeasureUnit();
// 13.b Set intlObj.[[Unit]] to unit. // 13.b Set intlObj.[[Unit]] to unit.
if (unit_pair.first != none) { if (unit_pair.first != AVOID_AMBIGUOUS_OP_WARNING(none)) {
settings = settings.unit(unit_pair.first); settings = settings.unit(unit_pair.first);
} }
if (unit_pair.second != none) { if (unit_pair.second != AVOID_AMBIGUOUS_OP_WARNING(none)) {
settings = settings.perUnit(unit_pair.second); settings = settings.perUnit(unit_pair.second);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment