[arch-commits] Commit in electron5/trunk (3 files)

Evangelos Foutras foutrelis at archlinux.org
Wed Apr 29 12:35:32 UTC 2020


    Date: Wednesday, April 29, 2020 @ 12:35:31
  Author: foutrelis
Revision: 622254

Fix build with ICU 67 and clang 10

Added:
  electron5/trunk/glslang-remove-setAllocator.patch
  electron5/trunk/simplified-ListFormat-implementation.patch
Modified:
  electron5/trunk/PKGBUILD

--------------------------------------------+
 PKGBUILD                                   |    7 
 glslang-remove-setAllocator.patch          |   24 ++
 simplified-ListFormat-implementation.patch |  252 +++++++++++++++++++++++++++
 3 files changed, 283 insertions(+)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-04-29 12:33:20 UTC (rev 622253)
+++ PKGBUILD	2020-04-29 12:35:31 UTC (rev 622254)
@@ -27,6 +27,8 @@
         'chromium-media-fix-build-with-libstdc++.patch'
         'chromium-skia-harmony.patch'
         'icu65.patch'
+        'simplified-ListFormat-implementation.patch'
+        'glslang-remove-setAllocator.patch'
         'chromium-system-icu.patch'
         'chromium-webrtc-fix-SIOCGSTAMP-include.patch'
        )
@@ -40,6 +42,8 @@
             'f51fe91427d8638c5551746d2ec7de99e8059dd76889cfeaee8ca3d8fed62265'
             '5887f78b55c4ecbbcba5930f3f0bb7bc0117c2a41c2f761805fcf7f46f1ca2b3'
             '1de9bdbfed482295dda45c7d4e323cee55a34e42f66b892da1c1a778682b7a41'
+            '49cb3444eae2bf8aa83b4f8704023512dba4bf30f3caafc6dbd5ed874b7da72b'
+            '06738b3f2d3579cd9b4d1ff876ba93d6b10a741b4deb4eab7fe3008cc577c893'
             'e2d284311f49c529ea45083438a768db390bde52949995534034d2a814beab89'
             'f73a3226b60833f7cc12f2bd8e3569284e6c26ea6cdd97eb5f45797ed29a323a')
 
@@ -140,6 +144,9 @@
   patch -d media -Np1 -i ../../chromium-media-fix-build-with-libstdc++.patch
   patch -Np0 -i ../chromium-skia-harmony.patch
   patch -Np1 -i ../icu65.patch
+  patch -Np1 -d v8 <../simplified-ListFormat-implementation.patch
+  patch -Np1 -d third_party/glslang/src <../glslang-remove-setAllocator.patch
+  patch -Np1 -d third_party/angle/third_party/glslang/src <../glslang-remove-setAllocator.patch
   patch -Np1 -i ../chromium-system-icu.patch
   patch -Np1 -i ../chromium-webrtc-fix-SIOCGSTAMP-include.patch
   patch -Np1 -i ../use-system-libraries-in-node.patch

Added: glslang-remove-setAllocator.patch
===================================================================
--- glslang-remove-setAllocator.patch	                        (rev 0)
+++ glslang-remove-setAllocator.patch	2020-04-29 12:35:31 UTC (rev 622254)
@@ -0,0 +1,24 @@
+From 24b3e8384e93f3e73b6aa14ea00a30574112f9ba Mon Sep 17 00:00:00 2001
+From: Reid Kleckner <rnk at google.com>
+Date: Wed, 4 Dec 2019 14:09:03 -0800
+Subject: [PATCH] Remove glslang::pool_allocator::setAllocator
+
+TPoolAllocator is not copy assignable, so this setter could never have
+been used. After a recent change (878a24ee2), new versions of Clang
+reject this code outright.
+---
+ glslang/Include/PoolAlloc.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h
+index 0e237a6a2..b8eccb883 100644
+--- a/glslang/Include/PoolAlloc.h
++++ b/glslang/Include/PoolAlloc.h
+@@ -304,7 +304,6 @@ class pool_allocator {
+     size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
+     size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
+ 
+-    void setAllocator(TPoolAllocator* a) { allocator = *a; }
+     TPoolAllocator& getAllocator() const { return allocator; }
+ 
+ protected:

Added: simplified-ListFormat-implementation.patch
===================================================================
--- simplified-ListFormat-implementation.patch	                        (rev 0)
+++ simplified-ListFormat-implementation.patch	2020-04-29 12:35:31 UTC (rev 622254)
@@ -0,0 +1,252 @@
+From 77ae23b73f4dff5c84bd147eadc45e8b05297875 Mon Sep 17 00:00:00 2001
+From: Frank Tang <ftang at chromium.org>
+Date: Mon, 15 Apr 2019 17:25:17 -0700
+Subject: [PATCH] [Intl] Simplified ListFormat implementation
+
+Use ICU64 new API formatStringsToValue
+
+Bug: v8:8836
+Change-Id: I7399a301b2536f331b1df1e1845adf2e533bafb9
+Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1560659
+Commit-Queue: Frank Tang <ftang at chromium.org>
+Reviewed-by: Sathya Gunasekaran <gsathya at chromium.org>
+Cr-Commit-Position: refs/heads/master@{#60856}
+---
+ src/objects/js-list-format.cc | 185 ++++++++++++++--------------------
+ src/objects/js-list-format.h  |   1 -
+ 2 files changed, 76 insertions(+), 110 deletions(-)
+
+diff --git a/src/objects/js-list-format.cc b/src/objects/js-list-format.cc
+index e6f9c76a61..ab780605cd 100644
+--- a/src/objects/js-list-format.cc
++++ b/src/objects/js-list-format.cc
+@@ -273,78 +273,6 @@ Handle<String> JSListFormat::TypeAsString() const {
+ 
+ namespace {
+ 
+-MaybeHandle<JSArray> GenerateListFormatParts(
+-    Isolate* isolate, const icu::UnicodeString& formatted,
+-    const std::vector<icu::FieldPosition>& positions) {
+-  Factory* factory = isolate->factory();
+-  Handle<JSArray> array =
+-      factory->NewJSArray(static_cast<int>(positions.size()));
+-  int index = 0;
+-  int prev_item_end_index = 0;
+-  Handle<String> substring;
+-  for (const icu::FieldPosition pos : positions) {
+-    CHECK(pos.getBeginIndex() >= prev_item_end_index);
+-    CHECK(pos.getField() == ULISTFMT_ELEMENT_FIELD);
+-    if (pos.getBeginIndex() != prev_item_end_index) {
+-      ASSIGN_RETURN_ON_EXCEPTION(
+-          isolate, substring,
+-          Intl::ToString(isolate, formatted, prev_item_end_index,
+-                         pos.getBeginIndex()),
+-          JSArray);
+-      Intl::AddElement(isolate, array, index++, factory->literal_string(),
+-                       substring);
+-    }
+-    ASSIGN_RETURN_ON_EXCEPTION(
+-        isolate, substring,
+-        Intl::ToString(isolate, formatted, pos.getBeginIndex(),
+-                       pos.getEndIndex()),
+-        JSArray);
+-    Intl::AddElement(isolate, array, index++, factory->element_string(),
+-                     substring);
+-    prev_item_end_index = pos.getEndIndex();
+-  }
+-  if (prev_item_end_index != formatted.length()) {
+-    ASSIGN_RETURN_ON_EXCEPTION(
+-        isolate, substring,
+-        Intl::ToString(isolate, formatted, prev_item_end_index,
+-                       formatted.length()),
+-        JSArray);
+-    Intl::AddElement(isolate, array, index++, factory->literal_string(),
+-                     substring);
+-  }
+-  return array;
+-}
+-
+-// Get all the FieldPosition into a vector from FieldPositionIterator and return
+-// them in output order.
+-std::vector<icu::FieldPosition> GenerateFieldPosition(
+-    icu::FieldPositionIterator iter) {
+-  std::vector<icu::FieldPosition> positions;
+-  icu::FieldPosition pos;
+-  while (iter.next(pos)) {
+-    // Only take the information of the ULISTFMT_ELEMENT_FIELD field.
+-    if (pos.getField() == ULISTFMT_ELEMENT_FIELD) {
+-      positions.push_back(pos);
+-    }
+-  }
+-  // Because the format may reoder the items, ICU FieldPositionIterator
+-  // keep the order for FieldPosition based on the order of the input items.
+-  // But the formatToParts API in ECMA402 expects in formatted output order.
+-  // Therefore we have to sort based on beginIndex of the FieldPosition.
+-  // Example of such is in the "ur" (Urdu) locale with type: "unit", where the
+-  // main text flows from right to left, the formatted list of unit should flow
+-  // from left to right and therefore in the memory the formatted result will
+-  // put the first item on the last in the result string according the current
+-  // CLDR patterns.
+-  // See 'listPattern' pattern in
+-  // third_party/icu/source/data/locales/ur_IN.txt
+-  std::sort(positions.begin(), positions.end(),
+-            [](icu::FieldPosition a, icu::FieldPosition b) {
+-              return a.getBeginIndex() < b.getBeginIndex();
+-            });
+-  return positions;
+-}
+-
+ // Extract String from JSArray into array of UnicodeString
+ Maybe<std::vector<icu::UnicodeString>> ToUnicodeStringArray(
+     Isolate* isolate, Handle<JSArray> array) {
+@@ -384,31 +312,95 @@ Maybe<std::vector<icu::UnicodeString>> ToUnicodeStringArray(
+   return Just(result);
+ }
+ 
+-}  // namespace
+-
+-// ecma402 #sec-formatlist
+-MaybeHandle<String> JSListFormat::FormatList(Isolate* isolate,
+-                                             Handle<JSListFormat> format,
+-                                             Handle<JSArray> list) {
++template <typename T>
++MaybeHandle<T> FormatListCommon(
++    Isolate* isolate, Handle<JSListFormat> format, Handle<JSArray> list,
++    MaybeHandle<T> (*formatToResult)(Isolate*, const icu::FormattedList&)) {
+   DCHECK(!list->IsUndefined());
+   // ecma402 #sec-createpartsfromlist
+   // 2. If list contains any element value such that Type(value) is not String,
+   // throw a TypeError exception.
+   Maybe<std::vector<icu::UnicodeString>> maybe_array =
+       ToUnicodeStringArray(isolate, list);
+-  MAYBE_RETURN(maybe_array, Handle<String>());
++  MAYBE_RETURN(maybe_array, Handle<T>());
+   std::vector<icu::UnicodeString> array = maybe_array.FromJust();
+ 
+   icu::ListFormatter* formatter = format->icu_formatter()->raw();
+   CHECK_NOT_NULL(formatter);
+ 
+   UErrorCode status = U_ZERO_ERROR;
+-  icu::UnicodeString formatted;
+-  formatter->format(array.data(), static_cast<int32_t>(array.size()), formatted,
+-                    status);
+-  DCHECK(U_SUCCESS(status));
++  icu::FormattedList formatted = formatter->formatStringsToValue(
++      array.data(), static_cast<int32_t>(array.size()), status);
++  if (U_FAILURE(status)) {
++    THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), T);
++  }
++  return formatToResult(isolate, formatted);
++}
++
++// A helper function to convert the FormattedList to a
++// MaybeHandle<String> for the implementation of format.
++MaybeHandle<String> FormattedToString(Isolate* isolate,
++                                      const icu::FormattedList& formatted) {
++  UErrorCode status = U_ZERO_ERROR;
++  icu::UnicodeString result = formatted.toString(status);
++  if (U_FAILURE(status)) {
++    THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), String);
++  }
++  return Intl::ToString(isolate, result);
++}
++
++Handle<String> IcuFieldIdToType(Isolate* isolate, int32_t field_id) {
++  switch (field_id) {
++    case ULISTFMT_LITERAL_FIELD:
++      return isolate->factory()->literal_string();
++    case ULISTFMT_ELEMENT_FIELD:
++      return isolate->factory()->element_string();
++    default:
++      UNREACHABLE();
++      // To prevent MSVC from issuing C4715 warning.
++      return Handle<String>();
++  }
++}
++
++// A helper function to convert the FormattedList to a
++// MaybeHandle<JSArray> for the implementation of formatToParts.
++MaybeHandle<JSArray> FormattedToJSArray(Isolate* isolate,
++                                        const icu::FormattedList& formatted) {
++  Handle<JSArray> array = isolate->factory()->NewJSArray(0);
++  icu::ConstrainedFieldPosition cfpos;
++  cfpos.constrainCategory(UFIELD_CATEGORY_LIST);
++  int index = 0;
++  UErrorCode status = U_ZERO_ERROR;
++  icu::UnicodeString string = formatted.toString(status);
++  Handle<String> substring;
++  while (formatted.nextPosition(cfpos, status) && U_SUCCESS(status)) {
++    ASSIGN_RETURN_ON_EXCEPTION(
++        isolate, substring,
++        Intl::ToString(isolate, string, cfpos.getStart(), cfpos.getLimit()),
++        JSArray);
++    Intl::AddElement(isolate, array, index++,
++                     IcuFieldIdToType(isolate, cfpos.getField()), substring);
++  }
++  if (U_FAILURE(status)) {
++    THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), JSArray);
++  }
++  JSObject::ValidateElements(*array);
++  return array;
++}
++
++}  // namespace
++
++// ecma402 #sec-formatlist
++MaybeHandle<String> JSListFormat::FormatList(Isolate* isolate,
++                                             Handle<JSListFormat> format,
++                                             Handle<JSArray> list) {
++  return FormatListCommon<String>(isolate, format, list, FormattedToString);
++}
+ 
+-  return Intl::ToString(isolate, formatted);
++// ecma42 #sec-formatlisttoparts
++MaybeHandle<JSArray> JSListFormat::FormatListToParts(
++    Isolate* isolate, Handle<JSListFormat> format, Handle<JSArray> list) {
++  return FormatListCommon<JSArray>(isolate, format, list, FormattedToJSArray);
+ }
+ 
+ std::set<std::string> JSListFormat::GetAvailableLocales() {
+@@ -422,30 +414,5 @@ std::set<std::string> JSListFormat::GetAvailableLocales() {
+   return Intl::BuildLocaleSet(icu_available_locales, num_locales);
+ }
+ 
+-// ecma42 #sec-formatlisttoparts
+-MaybeHandle<JSArray> JSListFormat::FormatListToParts(
+-    Isolate* isolate, Handle<JSListFormat> format, Handle<JSArray> list) {
+-  DCHECK(!list->IsUndefined());
+-  // ecma402 #sec-createpartsfromlist
+-  // 2. If list contains any element value such that Type(value) is not String,
+-  // throw a TypeError exception.
+-  Maybe<std::vector<icu::UnicodeString>> maybe_array =
+-      ToUnicodeStringArray(isolate, list);
+-  MAYBE_RETURN(maybe_array, Handle<JSArray>());
+-  std::vector<icu::UnicodeString> array = maybe_array.FromJust();
+-
+-  icu::ListFormatter* formatter = format->icu_formatter()->raw();
+-  CHECK_NOT_NULL(formatter);
+-
+-  UErrorCode status = U_ZERO_ERROR;
+-  icu::UnicodeString formatted;
+-  icu::FieldPositionIterator iter;
+-  formatter->format(array.data(), static_cast<int32_t>(array.size()), formatted,
+-                    &iter, status);
+-  DCHECK(U_SUCCESS(status));
+-
+-  std::vector<icu::FieldPosition> field_positions = GenerateFieldPosition(iter);
+-  return GenerateListFormatParts(isolate, formatted, field_positions);
+-}
+ }  // namespace internal
+ }  // namespace v8
+diff --git a/src/objects/js-list-format.h b/src/objects/js-list-format.h
+index 1ae6fcdb84..6054e488cd 100644
+--- a/src/objects/js-list-format.h
++++ b/src/objects/js-list-format.h
+@@ -106,7 +106,6 @@ class JSListFormat : public JSObject {
+ 
+   // Layout description.
+ #define JS_LIST_FORMAT_FIELDS(V)      \
+-  V(kJSListFormatOffset, kTaggedSize) \
+   V(kLocaleOffset, kTaggedSize)       \
+   V(kICUFormatterOffset, kTaggedSize) \
+   V(kFlagsOffset, kTaggedSize)        \



More information about the arch-commits mailing list