Skip to content

Commit 9f081ca

Browse files
committed
Cherry-pick 'Improve compiler compatibility'
1 parent 1b071d7 commit 9f081ca

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
diff --git a/src/common/local_file_system.cpp b/src/common/local_file_system.cpp
2+
index e650d79beb..99420fffbd 100644
3+
--- a/src/common/local_file_system.cpp
4+
+++ b/src/common/local_file_system.cpp
5+
@@ -29,6 +29,7 @@
6+
#ifdef __MINGW32__
7+
// need to manually define this for mingw
8+
extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory(PULONGLONG);
9+
+extern "C" WINBASEAPI BOOL QueryFullProcessImageNameW(HANDLE, DWORD, LPWSTR, PDWORD);
10+
#endif
11+
12+
#undef FILE_CREATE // woo mingw
13+
diff --git a/src/common/types/row/tuple_data_allocator.cpp b/src/common/types/row/tuple_data_allocator.cpp
14+
index cb6f0bb182..02283b12a6 100644
15+
--- a/src/common/types/row/tuple_data_allocator.cpp
16+
+++ b/src/common/types/row/tuple_data_allocator.cpp
17+
@@ -13,7 +13,7 @@ TupleDataBlock::TupleDataBlock(BufferManager &buffer_manager, idx_t capacity_p)
18+
buffer_manager.Allocate(MemoryTag::HASH_TABLE, capacity, false, &handle);
19+
}
20+
21+
-TupleDataBlock::TupleDataBlock(TupleDataBlock &&other) noexcept {
22+
+TupleDataBlock::TupleDataBlock(TupleDataBlock &&other) noexcept : capacity(0), size(0) {
23+
std::swap(handle, other.handle);
24+
std::swap(capacity, other.capacity);
25+
std::swap(size, other.size);
26+
diff --git a/src/common/types/vector.cpp b/src/common/types/vector.cpp
27+
index aa08072ac5..7730a0c5af 100644
28+
--- a/src/common/types/vector.cpp
29+
+++ b/src/common/types/vector.cpp
30+
@@ -30,7 +30,7 @@ namespace duckdb {
31+
UnifiedVectorFormat::UnifiedVectorFormat() : sel(nullptr), data(nullptr) {
32+
}
33+
34+
-UnifiedVectorFormat::UnifiedVectorFormat(UnifiedVectorFormat &&other) noexcept {
35+
+UnifiedVectorFormat::UnifiedVectorFormat(UnifiedVectorFormat &&other) noexcept : sel(nullptr), data(nullptr) {
36+
bool refers_to_self = other.sel == &other.owned_sel;
37+
std::swap(sel, other.sel);
38+
std::swap(data, other.data);
39+
diff --git a/src/core_functions/aggregate/distributive/arg_min_max.cpp b/src/core_functions/aggregate/distributive/arg_min_max.cpp
40+
index c39b059996..6feffca464 100644
41+
--- a/src/core_functions/aggregate/distributive/arg_min_max.cpp
42+
+++ b/src/core_functions/aggregate/distributive/arg_min_max.cpp
43+
@@ -164,7 +164,7 @@ struct ArgMinMaxBase {
44+
if (!state.is_initialized || state.arg_null) {
45+
finalize_data.ReturnNull();
46+
} else {
47+
- STATE::template ReadValue(finalize_data.result, state.arg, target);
48+
+ STATE::template ReadValue<T>(finalize_data.result, state.arg, target);
49+
}
50+
}
51+
52+
@@ -248,7 +248,7 @@ struct VectorArgMinMaxBase : ArgMinMaxBase<COMPARATOR, IGNORE_NULL> {
53+
return;
54+
}
55+
if (!target.is_initialized || COMPARATOR::Operation(source.value, target.value)) {
56+
- STATE::template AssignValue(target.value, source.value);
57+
+ STATE::template AssignValue<typename STATE::BY_TYPE>(target.value, source.value);
58+
AssignVector(target, *source.arg, source.arg_null, 0);
59+
target.is_initialized = true;
60+
}
61+
diff --git a/src/core_functions/aggregate/distributive/bitagg.cpp b/src/core_functions/aggregate/distributive/bitagg.cpp
62+
index 2d57a4f548..af3056359a 100644
63+
--- a/src/core_functions/aggregate/distributive/bitagg.cpp
64+
+++ b/src/core_functions/aggregate/distributive/bitagg.cpp
65+
@@ -53,10 +53,10 @@ struct BitwiseOperation {
66+
template <class INPUT_TYPE, class STATE, class OP>
67+
static void Operation(STATE &state, const INPUT_TYPE &input, AggregateUnaryInput &) {
68+
if (!state.is_set) {
69+
- OP::template Assign(state, input);
70+
+ OP::template Assign<INPUT_TYPE>(state, input);
71+
state.is_set = true;
72+
} else {
73+
- OP::template Execute(state, input);
74+
+ OP::template Execute<INPUT_TYPE>(state, input);
75+
}
76+
}
77+
78+
@@ -79,10 +79,10 @@ struct BitwiseOperation {
79+
}
80+
if (!target.is_set) {
81+
// target is NULL, use source value directly.
82+
- OP::template Assign(target, source.value);
83+
+ OP::template Assign<typename STATE::TYPE>(target, source.value);
84+
target.is_set = true;
85+
} else {
86+
- OP::template Execute(target, source.value);
87+
+ OP::template Execute<typename STATE::TYPE>(target, source.value);
88+
}
89+
}
90+
91+
diff --git a/src/core_functions/aggregate/distributive/minmax.cpp b/src/core_functions/aggregate/distributive/minmax.cpp
92+
index d3a5dd49c6..0e40b45d05 100644
93+
--- a/src/core_functions/aggregate/distributive/minmax.cpp
94+
+++ b/src/core_functions/aggregate/distributive/minmax.cpp
95+
@@ -487,7 +487,7 @@ struct VectorMinMaxBase {
96+
if (!state.value) {
97+
Assign(state, input, i);
98+
} else {
99+
- OP::template Execute(state, input, i, count);
100+
+ OP::template Execute<STATE>(state, input, i, count);
101+
}
102+
}
103+
}
104+
@@ -499,7 +499,7 @@ struct VectorMinMaxBase {
105+
} else if (!target.value) {
106+
Assign(target, *source.value, 0);
107+
} else {
108+
- OP::template Execute(target, *source.value, 0, 1);
109+
+ OP::template Execute<STATE>(target, *source.value, 0, 1);
110+
}
111+
}
112+
113+
diff --git a/src/execution/window_executor.cpp b/src/execution/window_executor.cpp
114+
index 4d6b9b099c..e649ff2efb 100644
115+
--- a/src/execution/window_executor.cpp
116+
+++ b/src/execution/window_executor.cpp
117+
@@ -193,7 +193,7 @@ private:
118+
template <typename T, typename OP>
119+
struct OperationCompare : public std::function<bool(T, T)> {
120+
inline bool operator()(const T &lhs, const T &val) const {
121+
- return OP::template Operation(lhs, val);
122+
+ return OP::template Operation<T>(lhs, val);
123+
}
124+
};
125+
126+
diff --git a/src/include/duckdb/common/arrow/arrow_buffer.hpp b/src/include/duckdb/common/arrow/arrow_buffer.hpp
127+
index e1624ef64d..66dd863f7e 100644
128+
--- a/src/include/duckdb/common/arrow/arrow_buffer.hpp
129+
+++ b/src/include/duckdb/common/arrow/arrow_buffer.hpp
130+
@@ -32,7 +32,7 @@ struct ArrowBuffer {
131+
ArrowBuffer(const ArrowBuffer &other) = delete;
132+
ArrowBuffer &operator=(const ArrowBuffer &) = delete;
133+
//! enable move constructors
134+
- ArrowBuffer(ArrowBuffer &&other) noexcept {
135+
+ ArrowBuffer(ArrowBuffer &&other) noexcept : count(0), capacity(0) {
136+
std::swap(dataptr, other.dataptr);
137+
std::swap(count, other.count);
138+
std::swap(capacity, other.capacity);
139+
diff --git a/src/include/duckdb/function/scalar/regexp.hpp b/src/include/duckdb/function/scalar/regexp.hpp
140+
index 1b33d3c77f..fa6a3e91f8 100644
141+
--- a/src/include/duckdb/function/scalar/regexp.hpp
142+
+++ b/src/include/duckdb/function/scalar/regexp.hpp
143+
@@ -106,9 +106,12 @@ struct RegexStringPieceArgs {
144+
}
145+
146+
RegexStringPieceArgs &operator=(RegexStringPieceArgs &&other) noexcept {
147+
- std::swap(this->size, other.size);
148+
- std::swap(this->capacity, other.capacity);
149+
- std::swap(this->group_buffer, other.group_buffer);
150+
+ this->size = other.size;
151+
+ this->capacity = other.capacity;
152+
+ this->group_buffer = other.group_buffer;
153+
+ other.size = 0;
154+
+ other.capacity = 0;
155+
+ other.group_buffer = nullptr;
156+
return *this;
157+
}
158+
159+
diff --git a/src/storage/buffer/buffer_handle.cpp b/src/storage/buffer/buffer_handle.cpp
160+
index dc3be3f284..21226eb685 100644
161+
--- a/src/storage/buffer/buffer_handle.cpp
162+
+++ b/src/storage/buffer/buffer_handle.cpp
163+
@@ -11,7 +11,7 @@ BufferHandle::BufferHandle(shared_ptr<BlockHandle> handle_p, FileBuffer *node_p)
164+
: handle(std::move(handle_p)), node(node_p) {
165+
}
166+
167+
-BufferHandle::BufferHandle(BufferHandle &&other) noexcept {
168+
+BufferHandle::BufferHandle(BufferHandle &&other) noexcept : node(nullptr) {
169+
std::swap(node, other.node);
170+
std::swap(handle, other.handle);
171+
}

0 commit comments

Comments
 (0)