clang-tidy: Basic configuration
This also cleans up some outstanding issues detected by the
configuration.
Tested:
Ran through unit test scripts.
Change-Id: I3357a2280a681a87532d6d72315260db2ab73e87
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..f6ee139
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1 @@
+Checks: 'clang-analyzer-*'
diff --git a/test/internal/sdref.cpp b/test/internal/sdref.cpp
index 3b261d5..e8effa9 100644
--- a/test/internal/sdref.cpp
+++ b/test/internal/sdref.cpp
@@ -216,7 +216,14 @@
EXPECT_TRUE(event);
EXPECT_EQ(expected_event, event.get());
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wself-move"
+#endif
event = std::move(event);
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
EXPECT_TRUE(event);
EXPECT_EQ(expected_event, event.get());
EXPECT_CALL(mock, sd_event_unref(expected_event))
diff --git a/test/source/base.cpp b/test/source/base.cpp
index df855c1..75a6dde 100644
--- a/test/source/base.cpp
+++ b/test/source/base.cpp
@@ -327,7 +327,7 @@
{
EXPECT_CALL(mock, sd_event_source_set_prepare(expected_source, testing::_))
.WillOnce(Return(0));
- base->set_prepare(std::move([](Base&) {}));
+ base->set_prepare([](Base&) {});
EXPECT_TRUE(base->get_prepare());
Base::Callback callback = [](Base&) {};
@@ -342,7 +342,7 @@
{
EXPECT_CALL(mock, sd_event_source_set_prepare(expected_source, testing::_))
.WillOnce(Return(0));
- base->set_prepare(std::move([](Base&) {}));
+ base->set_prepare([](Base&) {});
EXPECT_TRUE(base->get_prepare());
EXPECT_CALL(mock, sd_event_source_set_prepare(expected_source, nullptr))