6ccb1d6293ee04969723e4be0d277e4f066c2852
[feed/packages.git] / libs / icu / patches / 010-max_align_t.patch
1 --- a/common/uarrsort.cpp
2 +++ b/common/uarrsort.cpp
3 @@ -37,7 +37,7 @@ enum {
4 };
5
6 static constexpr int32_t sizeInMaxAlignTs(int32_t sizeInBytes) {
7 - return (sizeInBytes + sizeof(std::max_align_t) - 1) / sizeof(std::max_align_t);
8 + return (sizeInBytes + sizeof(max_align_t) - 1) / sizeof(max_align_t);
9 }
10
11 /* UComparator convenience implementations ---------------------------------- */
12 @@ -141,7 +141,7 @@ static void
13 insertionSort(char *array, int32_t length, int32_t itemSize,
14 UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
15
16 - icu::MaybeStackArray<std::max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE)> v;
17 + icu::MaybeStackArray<max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE)> v;
18 if (sizeInMaxAlignTs(itemSize) > v.getCapacity() &&
19 v.resize(sizeInMaxAlignTs(itemSize)) == nullptr) {
20 *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
21 @@ -235,7 +235,7 @@ static void
22 quickSort(char *array, int32_t length, int32_t itemSize,
23 UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
24 /* allocate two intermediate item variables (x and w) */
25 - icu::MaybeStackArray<std::max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE) * 2> xw;
26 + icu::MaybeStackArray<max_align_t, sizeInMaxAlignTs(STACK_ITEM_SIZE) * 2> xw;
27 if(sizeInMaxAlignTs(itemSize)*2 > xw.getCapacity() &&
28 xw.resize(sizeInMaxAlignTs(itemSize) * 2) == nullptr) {
29 *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
30 --- a/common/utext.cpp
31 +++ b/common/utext.cpp
32 @@ -569,7 +569,7 @@ enum {
33
34 struct ExtendedUText {
35 UText ut;
36 - std::max_align_t extension;
37 + max_align_t extension;
38 };
39
40 static const UText emptyText = UTEXT_INITIALIZER;
41 @@ -584,7 +584,7 @@ utext_setup(UText *ut, int32_t extraSpac
42 // We need to heap-allocate storage for the new UText
43 int32_t spaceRequired = sizeof(UText);
44 if (extraSpace > 0) {
45 - spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(std::max_align_t);
46 + spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(max_align_t);
47 }
48 ut = (UText *)uprv_malloc(spaceRequired);
49 if (ut == NULL) {
50 --- a/tools/toolutil/toolutil.cpp
51 +++ b/tools/toolutil/toolutil.cpp
52 @@ -266,7 +266,7 @@ struct UToolMemory {
53 char name[64];
54 int32_t capacity, maxCapacity, size, idx;
55 void *array;
56 - alignas(std::max_align_t) char staticArray[1];
57 + alignas(max_align_t) char staticArray[1];
58 };
59
60 U_CAPI UToolMemory * U_EXPORT2