mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 03:45:51 +00:00
fix gcc 9/10 warnings
This commit is contained in:
parent
d1d14111cb
commit
903725314c
6 changed files with 14 additions and 18 deletions
|
@ -19,8 +19,7 @@ Revision History:
|
|||
|
||||
|
||||
--*/
|
||||
#ifndef BUFFER_H_
|
||||
#define BUFFER_H_
|
||||
#pragma once
|
||||
|
||||
#include<string.h>
|
||||
#include "util/memory_manager.h"
|
||||
|
@ -42,7 +41,9 @@ protected:
|
|||
void expand() {
|
||||
unsigned new_capacity = m_capacity << 1;
|
||||
T * new_buffer = reinterpret_cast<T*>(memory::allocate(sizeof(T) * new_capacity));
|
||||
memcpy(new_buffer, m_buffer, m_pos * sizeof(T));
|
||||
for (unsigned i = 0; i < m_pos; ++i) {
|
||||
new (&new_buffer[i]) T(std::move(m_buffer[i]));
|
||||
}
|
||||
free_memory();
|
||||
m_buffer = new_buffer;
|
||||
m_capacity = new_capacity;
|
||||
|
@ -269,7 +270,3 @@ public:
|
|||
sbuffer(): buffer<T, false, INITIAL_SIZE>() {}
|
||||
sbuffer(unsigned sz, const T& elem) : buffer<T, false, INITIAL_SIZE>(sz,elem) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* BUFFER_H_ */
|
||||
|
|
|
@ -79,11 +79,7 @@ class vector {
|
|||
throw default_exception("Overflow encountered when expanding vector");
|
||||
}
|
||||
SZ *mem, *old_mem = reinterpret_cast<SZ*>(m_data) - 2;
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
|
||||
if (__has_trivial_copy(T)) {
|
||||
#else
|
||||
if (std::is_trivially_copyable<T>::value) {
|
||||
#endif
|
||||
mem = (SZ*)memory::reallocate(old_mem, new_capacity_T);
|
||||
m_data = reinterpret_cast<T *>(mem + 2);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue