compilation fix & warnings

This commit is contained in:
Alex Alabuzhev 2018-02-14 23:30:55 +00:00 committed by Victor Zverovich
parent 229887bd40
commit 24d66c5d65
2 changed files with 19 additions and 16 deletions

View File

@ -346,7 +346,7 @@ class container_buffer : public basic_buffer<typename Container::value_type> {
Container &container_;
protected:
virtual void grow(std::size_t capacity) {
void grow(std::size_t capacity) FMT_OVERRIDE {
container_.resize(capacity);
this->set(&container_[0], capacity);
}
@ -801,10 +801,10 @@ class context_base {
// Extracts a reference to the container from back_insert_iterator.
template <typename Container>
inline Container &get_container(std::back_insert_iterator<Container> it) {
typedef std::back_insert_iterator<Container> iterator;
struct accessor: iterator {
accessor(iterator it) : iterator(it) {}
using iterator::container;
typedef std::back_insert_iterator<Container> bi_iterator;
struct accessor: bi_iterator {
accessor(bi_iterator it) : bi_iterator(it) {}
using bi_iterator::container;
};
return *accessor(it).container;
}
@ -865,11 +865,8 @@ typedef buffer_context<wchar_t>::type wcontext;
namespace internal {
template <typename Context, typename T>
class get_type {
private:
static const T& val();
public:
typedef decltype(make_value<Context>(val())) value_type;
typedef decltype(make_value<Context>(std::declval<typename std::decay<T>::type&>())) value_type;
static const type value = value_type::type_tag;
};

View File

@ -382,7 +382,7 @@ class basic_memory_buffer: private Allocator, public internal::basic_buffer<T> {
}
protected:
void grow(std::size_t size);
void grow(std::size_t size) FMT_OVERRIDE;
public:
explicit basic_memory_buffer(const Allocator &alloc = Allocator())
@ -494,7 +494,7 @@ class basic_fixed_buffer : public internal::basic_buffer<Char> {
}
protected:
FMT_API void grow(std::size_t size);
FMT_API void grow(std::size_t size) FMT_OVERRIDE;
};
namespace internal {
@ -567,7 +567,7 @@ template <typename Char>
class null_terminating_iterator;
template <typename Char>
FMT_CONSTEXPR const Char *pointer_from(null_terminating_iterator<Char> it);
FMT_CONSTEXPR_DECL const Char *pointer_from(null_terminating_iterator<Char> it);
// An iterator that produces a null terminator on *end. This simplifies parsing
// and allows comparing the performance of processing a null-terminated string
@ -642,7 +642,13 @@ class null_terminating_iterator {
return ptr_ >= other.ptr_;
}
// 'fmt::internal::pointer_from': the inline specifier cannot be used
// when a friend declaration refers to a specialization of a function
// pointer_from is defined with the inline specifier, but declared without,
// so this looks like a bug in the compiler.
friend FMT_CONSTEXPR_DECL const Char *pointer_from<Char>(
# pragma warning(suppress: 4396)
null_terminating_iterator it);
private:
@ -1360,7 +1366,7 @@ class arg_formatter_base {
}
void write(const char_type *value) {
auto length = value != 0 ? std::char_traits<char_type>::length(value) : 0;
auto length = value != FMT_NULL ? std::char_traits<char_type>::length(value) : 0;
writer_.write_str(basic_string_view<char_type>(value, length), specs_);
}
@ -2220,7 +2226,7 @@ class basic_writer {
struct padded_int_writer {
string_view prefix;
wchar_t fill;
unsigned padding;
std::size_t padding;
F f;
template <typename It>
@ -2238,9 +2244,9 @@ class basic_writer {
template <typename Spec, typename F>
void write_int(unsigned num_digits, string_view prefix,
const Spec &spec, F f) {
unsigned size = prefix.size() + num_digits;
std::size_t size = prefix.size() + num_digits;
auto fill = spec.fill();
unsigned padding = 0;
std::size_t padding = 0;
if (spec.align() == ALIGN_NUMERIC) {
if (spec.width() > size) {
padding = spec.width() - size;