Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 573138 Details for
Bug 661880
www-client/chromium-75.0.3770.100[system-icu]: third_party/blink/renderer/platform/text/character.cc:67:55: error: no matching function for call to ‘size(const UChar32 [0])’
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
chromium-73.0.3683.86-system_icu_array_size_calculation_minimalistic_fix.patch
chromium-73.0.3683.86-system_icu_array_size_calculation_minimalistic_fix.patch (text/plain), 4.68 KB, created by
Arfrever Frehtes Taifersar Arahesis
on 2019-04-17 01:46:21 UTC
(
hide
)
Description:
chromium-73.0.3683.86-system_icu_array_size_calculation_minimalistic_fix.patch
Filename:
MIME Type:
Creator:
Arfrever Frehtes Taifersar Arahesis
Created:
2019-04-17 01:46:21 UTC
Size:
4.68 KB
patch
obsolete
>Chromium contains at least 2 ways of array size calculation: > >base/stl_util.h contains: >[[[ >namespace base { >... >template <typename T, size_t N> >constexpr size_t size(const T (&array)[N]) noexcept { > return N; >} >... >} >]]] > >third_party/blink/renderer/platform/text/character_property_data_generator.cc contains: >[[[ >#define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) >]]] > > >In C++, zero-length arrays can be defined, but some operations on them are not permitted >(by either Clang or GCC, even in GNU mode (-std=gnu++...)): >[[[ >$ cat test.h >#include <cstddef> > >namespace base { > >template <typename T, size_t N> >constexpr size_t size(const T (&array)[N]) noexcept { > return N; >} > >} > >#define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) > >int non_empty_array[] = {1, 3, 5, 7, 9}; >int empty_array[] = {}; >$ cat test_base::size_1.cpp >#include "test.h" > >int main() { > size_t x = base::size(non_empty_array); >} >$ cat test_base::size_2.cpp >#include "test.h" > >int main() { > size_t x = base::size(empty_array); >} >$ cat test_ARRAY_LENGTH_1.cpp >#include "test.h" > >int main() { > size_t x = ARRAY_LENGTH(non_empty_array); >} >$ cat test_ARRAY_LENGTH_2.cpp >#include "test.h" > >int main() { > size_t x = ARRAY_LENGTH(empty_array); >} >$ g++-8.3.0 -std=gnu++17 test_base::size_1.cpp >$ clang++-8 -std=gnu++17 test_base::size_1.cpp >$ g++-8.3.0 -std=gnu++17 test_base::size_2.cpp >test_base::size_2.cpp: In function âint main()â: >test_base::size_2.cpp:4:36: error: no matching function for call to âsize(int [0])â > size_t x = base::size(empty_array); > ^ >In file included from test_base::size_2.cpp:1: >test.h:6:18: note: candidate: âtemplate<class T, long unsigned int N> constexpr size_t base::size(const T (&)[N])â > constexpr size_t size(const T (&array)[N]) noexcept { > ^~~~ >test.h:6:18: note: template argument deduction/substitution failed: >$ clang++-8 -std=gnu++17 test_base::size_2.cpp >test_base::size_2.cpp:4:14: error: no matching function for call to 'size' > size_t x = base::size(empty_array); > ^~~~~~~~~~ >./test.h:6:18: note: candidate template ignored: substitution failure [with T = int, N = 0]: zero-length arrays are not permitted in C++ >constexpr size_t size(const T (&array)[N]) noexcept { > ^ ~ >1 error generated. >$ g++-8.3.0 -std=gnu++17 test_ARRAY_LENGTH_1.cpp >$ clang++-8 -std=gnu++17 test_ARRAY_LENGTH_1.cpp >$ g++-8.3.0 -std=gnu++17 test_ARRAY_LENGTH_2.cpp >$ clang++-8 -std=gnu++17 test_ARRAY_LENGTH_2.cpp >]]] > >As seen above, base::size() works with non-zero-length arrays and fails with zero-length arrays, >while ARRAY_LENGTH() works with both non-zero-length arrays and zero-length arrays. > > >third_party/blink/renderer/platform/text/character_property_data.h defines several arrays. >kIsHangulArray is a zero-length array. > >When Chromium is being built with bundled ICU, then array size calculation occurs >in third_party/blink/renderer/platform/text/character_property_data_generator.cc >in GenerateCharacterPropertyData() function, >which (through SET macro) uses ARRAY_LENGTH(), which works with zero-length arrays. > >When Chromium is being built with system ICU, then array size calculation occurs >in third_party/blink/renderer/platform/text/character.cc in several functions, >which (through RETURN_HAS_PROPERTY and CREATE_UNICODE_SET macros) use base::size(), which fails with zero-length arrays. > >The minimalistic fix is to make third_party/blink/renderer/platform/text/character.cc also use ARRAY_LENGTH() instead of base::size(). > >--- /third_party/blink/renderer/platform/text/character.cc >+++ /third_party/blink/renderer/platform/text/character.cc >@@ -63,9 +63,13 @@ > return unicodeSet; > } > >-#define CREATE_UNICODE_SET(name) \ >- createUnicodeSet(name##Array, base::size(name##Array), name##Ranges, \ >- base::size(name##Ranges)) >+// base::size (from base/stl_util.h) causes compilation errors >+// with zero-length arrays. >+#define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) >+ >+#define CREATE_UNICODE_SET(name) \ >+ createUnicodeSet(name##Array, ARRAY_LENGTH(name##Array), \ >+ name##Ranges, ARRAY_LENGTH(name##Ranges)) > > #define RETURN_HAS_PROPERTY(c, name) \ > static icu::UnicodeSet* unicodeSet = nullptr; \ >--- /third_party/blink/renderer/platform/text/character_property_data_generator.cc >+++ /third_party/blink/renderer/platform/text/character_property_data_generator.cc >@@ -22,6 +22,9 @@ > #else > > const UChar32 kMaxCodepoint = 0x10FFFF; >+ >+// base::size (from base/stl_util.h) causes compilation errors >+// with zero-length arrays. > #define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) > > static void SetRanges(CharacterProperty* values,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 661880
:
540582
|
542640
|
550198
|
550316
|
551632
| 573138 |
580230