summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-08-01 14:07:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-08-01 14:07:00 +0200
commit7d898e638abad8267420f8c0d827d21f716b8977 (patch)
tree897a31950ba0a345f05162e4e8616f26e1b69446
parentb930dd608bf95ecc3f89007313ba8ab8b1935ee5 (diff)
fix clang warnings
-rw-r--r--cmake/opentrack-boilerplate.cmake2
-rw-r--r--cmake/opentrack-qt.cmake4
-rw-r--r--compat/shm.cpp2
-rw-r--r--compat/shm.h3
-rw-r--r--filter-accela/accela-settings.hpp7
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp4
-rw-r--r--filter-accela/ftnoir_filter_accela.h3
-rw-r--r--filter-accela/ftnoir_filter_accela_dialog.cpp2
-rw-r--r--proto-libevdev/ftnoir_protocol_libevdev.cpp8
-rw-r--r--proto-wine/wine-shm.h9
-rw-r--r--qxt-mini/qxtglobalshortcut_x11.cpp10
-rw-r--r--spline/spline.cpp7
-rw-r--r--spline/spline.hpp16
13 files changed, 66 insertions, 11 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 614209da..ffa4ea02 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -208,7 +208,7 @@ function(otr_module n_)
if(CMAKE_COMPILER_IS_CLANGXX AND (arg_EXECUTABLE OR NOT arg_BIN))
set(opts
weak-vtables
- #header-hygiene
+ header-hygiene
)
foreach(k ${opts})
target_compile_options(${n} PRIVATE "-Wno-${k}")
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index b0d2de78..8c92483c 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -43,6 +43,10 @@ function(otr_qt2 n)
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_MESSAGELOGCONTEXT
)
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ set_property(SOURCE ${${n}-moc} ${${n}-rcc}
+ APPEND_STRING PROPERTY COMPILE_FLAGS " -w -Wno-error ")
+ endif()
endfunction()
include_directories("${CMAKE_BINARY_DIR}")
diff --git a/compat/shm.cpp b/compat/shm.cpp
index 1f863190..f59469dc 100644
--- a/compat/shm.cpp
+++ b/compat/shm.cpp
@@ -106,7 +106,7 @@ shm_wrapper::shm_wrapper(const char *shm_name, const char* /*mutex_name*/, int m
strcat(filename, shm_name);
fd = shm_open(filename, O_RDWR | O_CREAT, 0600);
(void) ftruncate(fd, map_size);
- mem = mmap(NULL, map_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t)0);
+ mem = mmap(nullptr, map_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t)0);
}
shm_wrapper::~shm_wrapper()
diff --git a/compat/shm.h b/compat/shm.h
index ece693ea..d1363219 100644
--- a/compat/shm.h
+++ b/compat/shm.h
@@ -28,7 +28,8 @@ class OTR_COMPAT_EXPORT shm_wrapper final
#if defined(_WIN32)
HANDLE mutex, mapped_file;
#else
- int fd, size;
+ int fd;
+ unsigned size;
#endif
public:
diff --git a/filter-accela/accela-settings.hpp b/filter-accela/accela-settings.hpp
index c873b0b4..b2f62a43 100644
--- a/filter-accela/accela-settings.hpp
+++ b/filter-accela/accela-settings.hpp
@@ -2,6 +2,9 @@
#include "spline/spline.hpp"
#include "options/options.hpp"
+
+namespace detail::accela {
+
using namespace options;
// ------------------------------------
@@ -52,3 +55,7 @@ struct settings_accela : opts
settings_accela() : opts("accela-sliders") {}
};
+
+} // ns detail::accela
+
+using detail::accela::settings_accela;
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp
index 5fa1676f..44a341e0 100644
--- a/filter-accela/ftnoir_filter_accela.cpp
+++ b/filter-accela/ftnoir_filter_accela.cpp
@@ -139,6 +139,8 @@ void accela::filter(const double* input, double *output)
}
}
+namespace detail::accela {
+
void settings_accela::make_splines(spline& rot, spline& pos)
{
rot.clear(); pos.clear();
@@ -150,4 +152,6 @@ void settings_accela::make_splines(spline& rot, spline& pos)
pos.add_point({ val.x, val.y });
}
+} // ns detail::accela
+
OPENTRACK_DECLARE_FILTER(accela, dialog_accela, accelaDll)
diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h
index 9112b0b8..6471a7b8 100644
--- a/filter-accela/ftnoir_filter_accela.h
+++ b/filter-accela/ftnoir_filter_accela.h
@@ -19,9 +19,8 @@
//#define DEBUG_ACCELA
-class accela : public IFilter
+struct accela : IFilter
{
-public:
accela();
void filter(const double* input, double *output) override;
void center() override { first_run = true; }
diff --git a/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp
index d63f27fd..37f265e1 100644
--- a/filter-accela/ftnoir_filter_accela_dialog.cpp
+++ b/filter-accela/ftnoir_filter_accela_dialog.cpp
@@ -13,6 +13,8 @@
#include "spline/spline-widget.hpp"
#include <QDialog>
+using namespace options;
+
dialog_accela::dialog_accela()
{
ui.setupUi(this);
diff --git a/proto-libevdev/ftnoir_protocol_libevdev.cpp b/proto-libevdev/ftnoir_protocol_libevdev.cpp
index 612f5b27..72c05dc5 100644
--- a/proto-libevdev/ftnoir_protocol_libevdev.cpp
+++ b/proto-libevdev/ftnoir_protocol_libevdev.cpp
@@ -1,4 +1,10 @@
// strerror_r(3)
+
+#ifdef __clang__
+# pragma clang diagnostic ignored "-Wreserved-id-macro"
+# pragma clang diagnostic ignored "-Wunused-macros"
+#endif
+
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L
#endif
@@ -113,7 +119,7 @@ void evdev::pose(const double* headpose) {
for (int i = 0; i < 6; i++)
{
- int value = headpose[i] * mid_input / max_value[i] + mid_input;
+ int value = (int)(headpose[i] * mid_input / max_value[i] + mid_input);
int normalized = clamp(value, min_input, max_input);
(void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], normalized);
}
diff --git a/proto-wine/wine-shm.h b/proto-wine/wine-shm.h
index a717dcc8..536f647f 100644
--- a/proto-wine/wine-shm.h
+++ b/proto-wine/wine-shm.h
@@ -3,9 +3,18 @@
#define WINE_SHM_NAME "facetracknoir-wine-shm"
#define WINE_MTX_NAME "facetracknoir-wine-mtx"
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wreserved-id-macro"
+#endif
+
// OSX sdk 10.8 build error otherwise
#undef _LIBCPP_MSVCRT
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
#include <memory>
template<typename t> using ptr = std::shared_ptr<t>;
diff --git a/qxt-mini/qxtglobalshortcut_x11.cpp b/qxt-mini/qxtglobalshortcut_x11.cpp
index 89a5e7a8..6647d803 100644
--- a/qxt-mini/qxtglobalshortcut_x11.cpp
+++ b/qxt-mini/qxtglobalshortcut_x11.cpp
@@ -69,6 +69,9 @@ using pair = QPair<quint32, quint32>;
struct keybinding final
{
+ keybinding(const keybinding&) = default;
+ keybinding& operator=(const keybinding&) = default;
+
quint32 code, mods;
int refcnt;
@@ -361,6 +364,8 @@ bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType,
bool is_release = false;
+ static_assert(std::is_same_v<xcb_key_press_event_t, xcb_key_release_event_t>);
+
xcb_key_press_event_t *kev = nullptr;
if (eventType == "xcb_generic_event_t") {
xcb_generic_event_t *ev = static_cast<xcb_generic_event_t *>(message);
@@ -368,10 +373,11 @@ bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType,
{
case XCB_KEY_RELEASE:
is_release = true;
- /*FALLTHROUGH*/
+ [[fallthrough]];
case XCB_KEY_PRESS:
kev = static_cast<xcb_key_press_event_t *>(message);
- /*FALLTHROUGH*/
+ break;
+
default:
break;
}
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 98a82711..eacf4feb 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -101,7 +101,7 @@ double spline::get_value_internal(int x) const
const float sign = signum(x);
x = std::abs(x);
const float ret_ = data[std::min(unsigned(x), value_count - 1)];
- return sign * clamp(ret_, 0, 1000);
+ return (double)(sign * clamp(ret_, 0, 1000));
}
void spline::ensure_in_bounds(const QList<QPointF>& points, int i, f& x, f& y)
@@ -155,6 +155,7 @@ void spline::update_interp_data() const
const double c = bucket_size_coefficient(list);
const double c_ = c * c_interp;
+ const float cf = (float)c, c_f = (float)c_;
for (unsigned i = 0; i < value_count; i++)
data[i] = magic_fill_value;
@@ -200,7 +201,7 @@ void spline::update_interp_data() const
};
// multiplier helps fill in all the x's needed
- const unsigned end = (unsigned)(c_ * (p2_x - p1_x)) + 1;
+ const unsigned end = (unsigned)(c_f * (p2_x - p1_x)) + 1;
const f end_(end);
for (unsigned k = 0; k <= end; k++)
@@ -209,7 +210,7 @@ void spline::update_interp_data() const
const f t2 = t*t;
const f t3 = t*t*t;
- const unsigned x = unsigned(f(.5) * c * (cx[0] + cx[1] * t + cx[2] * t2 + cx[3] * t3));
+ const unsigned x = unsigned(f(.5) * cf * (cx[0] + cx[1] * t + cx[2] * t2 + cx[3] * t3));
const float y = (float)(f(.5) * (cy[0] + cy[1] * t + cy[2] * t2 + cy[3] * t3));
if (x < value_count)
diff --git a/spline/spline.hpp b/spline/spline.hpp
index 85f1c969..e4f64069 100644
--- a/spline/spline.hpp
+++ b/spline/spline.hpp
@@ -48,6 +48,7 @@ public:
struct OTR_SPLINE_EXPORT base_spline_
{
+ base_spline_() = default;
virtual ~base_spline_();
virtual double get_value(double x) const = 0;
@@ -61,6 +62,9 @@ struct OTR_SPLINE_EXPORT base_spline_
virtual const points_t& get_points() const = 0;
virtual int get_point_count() const = 0;
+
+ base_spline_(const base_spline_&) = default;
+ base_spline_& operator=(const base_spline_&) = default;
};
struct OTR_SPLINE_EXPORT spline_settings_mixin
@@ -68,6 +72,10 @@ struct OTR_SPLINE_EXPORT spline_settings_mixin
virtual std::shared_ptr<base_settings> get_settings() = 0;
virtual std::shared_ptr<const base_settings> get_settings() const = 0;
+ spline_settings_mixin(const spline_settings_mixin&) = default;
+ spline_settings_mixin& operator=(const spline_settings_mixin&) = default;
+
+ spline_settings_mixin() = default;
virtual ~spline_settings_mixin();
};
@@ -79,11 +87,19 @@ struct OTR_SPLINE_EXPORT spline_modify_mixin
virtual void remove_point(int i) = 0;
virtual void clear() = 0;
+ spline_modify_mixin(const spline_modify_mixin&) = default;
+ spline_modify_mixin& operator=(const spline_modify_mixin&) = default;
+
+ spline_modify_mixin() = default;
virtual ~spline_modify_mixin();
};
struct OTR_SPLINE_EXPORT base_spline : base_spline_, spline_modify_mixin, spline_settings_mixin
{
+ base_spline(const base_spline&) = default;
+ base_spline& operator=(const base_spline&) = default;
+
+ base_spline() = default;
~base_spline() override;
};