fix(cmake): Make specific c++lib linking optional

- Do not enforce linking against libc++
- Fix various linter warnings
This commit is contained in:
Michael Carlberg
2016-10-25 20:14:44 +02:00
parent 27df2398f0
commit eac65cdabb
11 changed files with 55 additions and 42 deletions

View File

@ -460,4 +460,4 @@ class builder {
int m_fontindex = 1;
};
LEMONBUDDY_NS_END;
LEMONBUDDY_NS_END

View File

@ -33,11 +33,7 @@ namespace command_line {
*/
explicit option(
string flag, string flag_long, string desc, string token = "", const choices c = {})
: flag(flag)
, flag_long(flag_long)
, desc(desc)
, token(token)
, values(c) {}
: flag(flag), flag_long(flag_long), desc(desc), token(token), values(c) {}
};
// }}}
@ -101,7 +97,7 @@ namespace command_line {
}
for (auto& opt : m_opts) {
int pad = maxlen - opt.flag_long.length() - opt.token.length();
size_t pad = maxlen - opt.flag_long.length() - opt.token.length();
std::cout << " " << opt.flag << ", " << opt.flag_long;

View File

@ -563,7 +563,6 @@ namespace {
di::injector<T> configure_controller(inotify_watch_t& confwatch) {
// clang-format off
return di::make_injector(
di::bind<controller>().to<controller>(),
di::bind<>().to(confwatch),
configure_connection(),
configure_logger(),

View File

@ -128,14 +128,14 @@ class logger {
template <typename T>
decltype(auto) convert(T&& arg) const {
return forward<T>(arg);
};
}
/**
* Convert string to const char*
*/
const char* convert(string arg) const {
return arg.c_str();
};
}
/**
* Write the log message to the output channel
@ -150,10 +150,14 @@ class logger {
auto suffix = m_suffixes.find(level)->second;
// silence the compiler
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-security"
#endif
dprintf(m_fd, (prefix + format + suffix + "\n").c_str(), convert(values)...);
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}
private:

View File

@ -56,7 +56,7 @@ struct bar_settings {
};
snprintf(buffer, sizeof(buffer), "%dx%d+%d+%d", width, height, x, y);
return string{*buffer};
};
}
};
struct tray_settings {
@ -105,7 +105,6 @@ struct action_block {
#endif
};
struct wmsettings_bspwm {
};
struct wmsettings_bspwm {};
LEMONBUDDY_NS_END

View File

@ -7,21 +7,16 @@
LEMONBUDDY_NS
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
union rgba {
struct {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
} _;
uint32_t v;
};
#pragma clang diagnostic pop
static map<string, class color> g_colorstore;
class color {
@ -29,9 +24,9 @@ class color {
explicit color(string hex) : m_hex(string_util::upper(hex)) {
m_rgba.v = static_cast<uint32_t>(strtoul(&hex[1], nullptr, 16));
// premultiply alpha
m_rgba.r = m_rgba.r * m_rgba.a / 255;
m_rgba.g = m_rgba.g * m_rgba.a / 255;
m_rgba.b = m_rgba.b * m_rgba.a / 255;
m_rgba._.r = m_rgba._.r * m_rgba._.a / 255;
m_rgba._.g = m_rgba._.g * m_rgba._.a / 255;
m_rgba._.b = m_rgba._.b * m_rgba._.a / 255;
}
explicit color(uint32_t v) {

View File

@ -25,7 +25,7 @@ namespace draw_util {
* Code: http://wmdia.sourceforge.net/
*/
auto xcb_poly_text_16_patched(xcb_connection_t* conn, xcb_drawable_t d, xcb_gcontext_t gc,
int16_t x, int16_t y, uint32_t len, uint16_t* str) {
int16_t x, int16_t y, uint8_t len, uint16_t* str) {
static const xcb_protocol_request_t xcb_req = {
5, // count
0, // ext