Skip to content

Commit

Permalink
compilation fix & warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Feb 15, 2018
1 parent 229887b commit 7e15547
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
15 changes: 6 additions & 9 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<std::decay<T&>::type>())) value_type;
static const type value = value_type::type_tag;
};

Expand Down
20 changes: 13 additions & 7 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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_);
}

Expand Down Expand Up @@ -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>
Expand All @@ -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;
Expand Down

0 comments on commit 7e15547

Please sign in to comment.