Skip to content

Commit b641065

Browse files
committed
Added a pragma for avoiding maybe-uninitialized warning.
1 parent 60d4b28 commit b641065

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/msgpack/v1/adaptor/map.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,22 @@ struct object_with_zone<std::map<K, V, Compare, Alloc> > {
194194
}
195195
else {
196196
uint32_t size = checked_get_container_size(v.size());
197+
197198
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size));
198199
msgpack::object_kv* const pend = p + size;
199200
o.via.map.ptr = p;
200201
o.via.map.size = size;
201202
typename std::map<K, V, Compare, Alloc>::const_iterator it(v.begin());
202203
do {
204+
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
205+
#pragma GCC diagnostic push
206+
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
207+
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
203208
p->key = msgpack::object(it->first, o.zone);
204209
p->val = msgpack::object(it->second, o.zone);
210+
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
211+
#pragma GCC diagnostic pop
212+
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)
205213
++p;
206214
++it;
207215
} while(p < pend);

0 commit comments

Comments
 (0)