From 6ad282726da6fdab2d69b2c96e84feb16867325f Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flow@cs.fau.de>
Date: Tue, 26 Jan 2021 12:55:24 +0100
Subject: [PATCH] [clang-tidy] Add HeaderFilterRegex and fix related clang-tidy
 reports

---
 .clang-tidy                         |  2 ++
 emper/Actor.hpp                     |  2 +-
 emper/Context.hpp                   |  2 +-
 emper/Fiber.hpp                     |  4 ++--
 emper/io/IoContext.hpp              |  2 +-
 tests/AlarmActorTest.cpp            |  9 ++++-----
 tests/SimpleActorTest.cpp           | 11 +++++------
 tests/TellActorFromAnywhereTest.cpp |  3 +--
 tests/UnblockOnMainActorTest.cpp    | 13 ++++++-------
 9 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy
index aa5e578a..237902b6 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -19,3 +19,5 @@ WarningsAsErrors: >
   clang-*,
   readability-*,
   performance-*,
+
+HeaderFilterRegex: emper/*
diff --git a/emper/Actor.hpp b/emper/Actor.hpp
index da6c6551..f2b1d57b 100644
--- a/emper/Actor.hpp
+++ b/emper/Actor.hpp
@@ -60,7 +60,7 @@ class Actor {
 	void start() {
 		if (state.load(std::memory_order_acquire) != Stopped) return;
 
-		Fiber* actorFiber = Fiber::from(std::bind(&Actor::actorLoop, this));
+		Fiber* actorFiber = Fiber::from([this] { actorLoop(); });
 		if constexpr (callerEnvironment == CallerEnvironment::EMPER) {
 			runtime.schedule(*actorFiber);
 		} else {
diff --git a/emper/Context.hpp b/emper/Context.hpp
index 3428ccc2..70727a12 100644
--- a/emper/Context.hpp
+++ b/emper/Context.hpp
@@ -49,7 +49,7 @@ class ALIGN_TO_CACHE_LINE Context : Logger<LogSubsystem::C> {
 	// NOLINTNEXTLINE(modernize-avoid-c-arrays)
 	ALIGN_TO_CACHE_LINE char context[CONTEXT_SIZE];
 
-	friend auto operator<<(std::ostream&, const Context&) -> std::ostream&;
+	friend auto operator<<(std::ostream& strm, const Context& context) -> std::ostream&;
 
 	friend ContextManager;
 
diff --git a/emper/Fiber.hpp b/emper/Fiber.hpp
index 0449d3ba..01b6fba8 100644
--- a/emper/Fiber.hpp
+++ b/emper/Fiber.hpp
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright © 2020 Florian Schmaus
+// Copyright © 2020-2021 Florian Schmaus
 #pragma once
 
 #include <atomic>				// for atomic_uint, atomic, __atomic_base, memory...
@@ -110,7 +110,7 @@ class ALIGN_TO_CACHE_LINE Fiber : public Logger<LogSubsystem::F> {
 
 	void print() const;
 
-	friend auto operator<<(std::ostream&, const Fiber&) -> std::ostream&;
+	friend auto operator<<(std::ostream& strm, const Fiber& fiber) -> std::ostream&;
 
 	static inline auto from(fiber_fun_t function, void* arg) -> Fiber* {
 		return new Fiber(std::move(function), arg);
diff --git a/emper/io/IoContext.hpp b/emper/io/IoContext.hpp
index 943f6206..37081f41 100644
--- a/emper/io/IoContext.hpp
+++ b/emper/io/IoContext.hpp
@@ -37,7 +37,7 @@ class IoContext : public Logger<LogSubsystem::IO> {
 	static pthread_t globalCompleter;
 
 	/* function executed by the global completer thread */
-	static auto globalCompleterFunc(void *) -> void *;
+	static auto globalCompleterFunc(void *arg) -> void *;
 
 	// start the global completer thread
 	// this must be called after all worker IoContexts' eventfds are submitted
diff --git a/tests/AlarmActorTest.cpp b/tests/AlarmActorTest.cpp
index d3c5e340..a0f962b6 100644
--- a/tests/AlarmActorTest.cpp
+++ b/tests/AlarmActorTest.cpp
@@ -1,9 +1,8 @@
 // SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright © 2020 Florian Fischer
-#include <cstdlib>		 // for exit, EXIT_FAILURE, EXIT_SUC...
-#include <functional>	 // bind
-#include <iostream>		 // for operator<<, basic_ostream
-#include <thread>			 // for hardware_concurrency
+// Copyright © 2020 Florian Fischer, 2021 Florian Schmaus
+#include <cstdlib>	 // for exit, EXIT_FAILURE, EXIT_SUC...
+#include <iostream>	 // for operator<<, basic_ostream
+#include <thread>		 // for hardware_concurrency
 
 #include "Actor.hpp"										 // for Actor
 #include "BinaryPrivateSemaphore.hpp"		 // for BPS
diff --git a/tests/SimpleActorTest.cpp b/tests/SimpleActorTest.cpp
index 57446856..3415863c 100644
--- a/tests/SimpleActorTest.cpp
+++ b/tests/SimpleActorTest.cpp
@@ -1,10 +1,9 @@
 // SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright © 2020 Florian Schmaus
-#include <atomic>			 // for atomic_thread_fence, memory_...
-#include <cstdint>		 // for uint64_t
-#include <cstdlib>		 // for exit, EXIT_FAILURE, EXIT_SUC...
-#include <functional>	 // for bind
-#include <iostream>		 // for operator<<, basic_ostream
+// Copyright © 2020-2021 Florian Schmaus
+#include <atomic>		 // for atomic_thread_fence, memory_...
+#include <cstdint>	 // for uint64_t
+#include <cstdlib>	 // for exit, EXIT_FAILURE, EXIT_SUC...
+#include <iostream>	 // for operator<<, basic_ostream
 
 #include "Actor.hpp"										 // for Actor
 #include "CountingPrivateSemaphore.hpp"	 // for CPS
diff --git a/tests/TellActorFromAnywhereTest.cpp b/tests/TellActorFromAnywhereTest.cpp
index bedfbd6d..70800ac1 100644
--- a/tests/TellActorFromAnywhereTest.cpp
+++ b/tests/TellActorFromAnywhereTest.cpp
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright © 2020 Florian Schmaus
-#include <functional>	 // for bind
+// Copyright © 2020-2021 Florian Schmaus
 #include <thread>
 
 #include "Actor.hpp"
diff --git a/tests/UnblockOnMainActorTest.cpp b/tests/UnblockOnMainActorTest.cpp
index 43c9def7..020db28f 100644
--- a/tests/UnblockOnMainActorTest.cpp
+++ b/tests/UnblockOnMainActorTest.cpp
@@ -1,11 +1,10 @@
 // SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright © 2020 Florian Fischer
-#include <atomic>			 // for atomic
-#include <cstdlib>		 // for exit, EXIT_FAILURE, EXIT_SUC...
-#include <ctime>			 // for nanosleep, timespec
-#include <functional>	 // bind
-#include <iostream>		 // for operator<<, basic_ostream
-#include <thread>			 // for this_thread
+// Copyright © 2020 Florian Fischer, 2021 Florian Schmaus
+#include <atomic>		 // for atomic
+#include <cstdlib>	 // for exit, EXIT_FAILURE, EXIT_SUC...
+#include <ctime>		 // for nanosleep, timespec
+#include <iostream>	 // for operator<<, basic_ostream
+#include <thread>		 // for this_thread
 
 #include "Actor.hpp"										 // for Actor
 #include "BinaryPrivateSemaphore.hpp"		 // for BPS
-- 
GitLab