fix compiler errors/warnings for clang 5.0

This commit is contained in:
Jinhao 2017-06-11 11:33:52 +08:00
parent bd38e96ed7
commit 0b4dc1904b
16 changed files with 29 additions and 21 deletions

View File

@ -62,7 +62,7 @@
# else
# undef STD_FILESYSTEM_NOT_SUPPORTED
# endif
#elif defined(__GNUC__)
#elif defined(__GNUC__) && not defined(__clang__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
# define noexcept //no support of noexcept until GCC 4.6
# endif

View File

@ -52,7 +52,7 @@ namespace detail
void position(const point& pos) override;
nana::point position() const override;
size dimension() const override;
void dimension(const size& s);
void dimension(const size& s) override;
void visible(bool visibility) override;
bool visible() const override;
private:

View File

@ -419,7 +419,7 @@ namespace nana
throw std::runtime_error("nana::listbox disallow to remove items because of immutable model");
}
void erase(std::size_t pos) override
void erase(std::size_t /*pos*/) override
{
throw std::runtime_error("nana::listbox disallow to remove items because of immutable model");
}
@ -434,7 +434,7 @@ namespace nana
return true;
}
void emplace(std::size_t pos) override
void emplace(std::size_t /*pos*/) override
{
throw std::runtime_error("nana::listbox disallow to remove items because of immutable model");
}
@ -444,7 +444,7 @@ namespace nana
throw std::runtime_error("nana::listbox disallow to remove items because of immutable model");
}
void assign(std::size_t pos, const std::vector<cell>& cells) override
void assign(std::size_t /*pos*/, const std::vector<cell>& /*cells*/) override
{
throw std::runtime_error("nana::listbox disallow to remove items because of immutable model");
}
@ -454,7 +454,7 @@ namespace nana
return ctrans_(container_.at(pos));
}
bool push_back(const const_virtual_pointer& dptr) override
bool push_back(const const_virtual_pointer& /*dptr*/) override
{
throw std::runtime_error("nana::listbox disallow to remove items because of immutable model");
}

View File

@ -50,7 +50,6 @@ namespace nana
virtual void caption(const point&, const native_string_type&);
scheme *scheme_ptr() const { return scheme_ptr_; };
private:
window handle_;
graph_reference graph_;
scheme *scheme_ptr_;
};

View File

@ -33,7 +33,7 @@ namespace nana{ namespace audio
prepared_.emplace_back(m);
}
thr_ = std::move(std::thread([this](){this->_m_prepare_routine();}));
thr_ = std::thread{[this](){this->_m_prepare_routine();}};
}
buffer_preparation::~buffer_preparation()

View File

@ -484,7 +484,7 @@ namespace nana
virtual std::string&& str_move()
{
if(is_unicode_)
data_ = std::move(str());
data_ = str();
return std::move(data_);
}
@ -506,6 +506,8 @@ namespace nana
std::u32string u32str = std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t>().from_bytes(data_);
return std::string(reinterpret_cast<const char*>(u32str.c_str()), u32str.size() * sizeof(char32_t));
}
default:
break; //no conversion
}
break;
case unicode::utf16:
@ -520,6 +522,8 @@ namespace nana
std::u32string u32str = std::wstring_convert<std::codecvt_utf16<char32_t>, char32_t>().from_bytes(data_);
return std::string(reinterpret_cast<const char*>(u32str.c_str()), u32str.size() * sizeof(char32_t));
}
default:
break; //no conversion
}
break;
case unicode::utf32:
@ -533,6 +537,8 @@ namespace nana
return std::wstring_convert<std::codecvt_utf16<char32_t>, char32_t>().to_bytes(
std::u32string(reinterpret_cast<const char32_t*>(data_.c_str()), data_.size() / sizeof(char32_t))
);
default:
break; //no conversion
}
break;
}
@ -588,7 +594,7 @@ namespace nana
virtual std::wstring && wstr_move()
{
wdata_for_move_ = std::move(wstr());
wdata_for_move_ = wstr();
return std::move(wdata_for_move_);
}
private:

View File

@ -21,7 +21,7 @@
#include <nana/push_ignore_diagnostic>
#include <X11/Xlocale.h>
#include <locale>
#include <clocale>
#include <map>
#include <set>
#include <algorithm>

View File

@ -454,7 +454,7 @@ namespace nana
thr->performance_parameter = 0.0;
thr->fps = p->fps;
thr->interval = 1000.0 / double(p->fps);
thr->thread = std::make_shared<std::thread>([this, thr]()
thr->thread = std::make_shared<std::thread>([thr]()
{
nana::system::timepiece tmpiece;
while (true)

View File

@ -270,7 +270,7 @@ namespace nana
return (reverse ? a > b : a < b);
});
ls_file_.set_sort_compare(3, [this](const std::string&, nana::any* anyptr_a, const std::string&, nana::any* anyptr_b, bool reverse) -> bool
ls_file_.set_sort_compare(3, [](const std::string&, nana::any* anyptr_a, const std::string&, nana::any* anyptr_b, bool reverse) -> bool
{
item_fs * fsa = any_cast<item_fs>(anyptr_a);
item_fs * fsb = any_cast<item_fs>(anyptr_b);

View File

@ -265,6 +265,9 @@ namespace nana
auto ico = impl_->icons[impl_->play_index++];
impl_->set_icon(ico);
#else
//eliminates warnings in clang
static_cast<void>(this);
#endif
});

View File

@ -68,13 +68,13 @@ namespace nana
API::dev::lazy_refresh();
}
void mouse_down(graph_reference graph, const arg_mouse&)
void mouse_down(graph_reference graph, const arg_mouse&) override
{
refresh(graph);
API::dev::lazy_refresh();
}
void mouse_up(graph_reference graph, const arg_mouse&)
void mouse_up(graph_reference graph, const arg_mouse&) override
{
refresh(graph);
API::dev::lazy_refresh();

View File

@ -195,7 +195,7 @@ namespace nana
_m_refresh();
}
void width(unsigned minimum, unsigned maximum)
void width(unsigned minimum, unsigned maximum) override
{
//maximum must be larger than minimum, but maximum == 0 is allowed if minimum is 0
if ((minimum >= maximum) && (minimum != 0))
@ -3531,7 +3531,7 @@ namespace nana
}
}
private:
void _m_draw_categ(const category_t& categ, int x, int y, int txtoff, unsigned width, const nana::rectangle& r, nana::color bgcolor, item_state state)
void _m_draw_categ(const category_t& categ, int x, int y, int txtoff, unsigned width, const nana::rectangle& /*r*/, nana::color bgcolor, item_state state)
{
const auto item_height = essence_->item_height();

View File

@ -85,7 +85,7 @@ namespace nana
//class item_renderer
item_renderer::item_renderer(window wd, graph_reference graph)
:handle_(wd), graph_(graph), scheme_ptr_(static_cast<scheme*>(API::dev::get_scheme(wd)))
:graph_(graph), scheme_ptr_(static_cast<scheme*>(API::dev::get_scheme(wd)))
{}
void item_renderer::background(const nana::point& pos, const nana::size& size, state item_state)

View File

@ -440,7 +440,7 @@ namespace nana{ namespace widgets
);
}
bool clear()
bool clear() override
{
if (colored_areas_.empty())
return false;

View File

@ -2200,7 +2200,7 @@ namespace nana
}
path.insert(0, pnode->value.first);
return std::move(path);
return path;
}
return{};
}

View File

@ -66,7 +66,7 @@ namespace nana
if (ifs.read(reinterpret_cast<char*>(&table_directory), sizeof table_directory).gcount() != sizeof table_directory)
return;
if (reinterpret_cast<const std::uint32_t&>("name") == reinterpret_cast<std::uint32_t&>(table_directory.name))
if (*reinterpret_cast<const std::uint32_t*>("name") == reinterpret_cast<std::uint32_t&>(table_directory.name))
{
//const std::size_t length = _m_swap(table_directory.length);
const std::size_t directory_offset = _m_swap(table_directory.offset);