From 522844ba05ee6cec4ca314c90ddbd6c5c8943b40 Mon Sep 17 00:00:00 2001
From: Florian Fischer <florian.fl.fischer@fau.de>
Date: Sat, 13 Mar 2021 17:36:50 +0100
Subject: [PATCH] remove or replace all EMPER_LOG_OFF checks

---
 emper/ContextManager.cpp  | 2 +-
 emper/Fiber.cpp           | 5 +----
 emper/Runtime.cpp         | 2 --
 emper/io/IoContext.cpp    | 5 +----
 emper/io/io.cpp           | 5 +----
 tests/SimpleActorTest.cpp | 5 +----
 6 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/emper/ContextManager.cpp b/emper/ContextManager.cpp
index b923c1b8..baab2fdf 100644
--- a/emper/ContextManager.cpp
+++ b/emper/ContextManager.cpp
@@ -61,7 +61,7 @@ void ContextManager::saveAndStartNew(func_t freshContextHook) {
 	Context::getCurrentContext()->saveAndStart(freeContext);
 }
 
-#ifdef EMPER_LOG_OFF
+#if Debug > EMPER_LOG_LEVEL
 #define HOOK_CAPTURE_LIST contextToFree
 #else
 // We only need to caputure 'this' for the LOGD() debug macro.
diff --git a/emper/Fiber.cpp b/emper/Fiber.cpp
index 3753d920..14a6dcc0 100644
--- a/emper/Fiber.cpp
+++ b/emper/Fiber.cpp
@@ -3,13 +3,10 @@
 #include "Fiber.hpp"
 
 #include <iostream>	 // for operator<<, basic_ostream, ostream, basic_ostrea...
+#include <typeinfo>	 // for type_info
 
 #include "emper-config.h"	 // IWYU pragma: keep
 
-#ifndef EMPER_LOG_OFF
-#include <typeinfo>	 // for type_info
-#endif
-
 void Fiber::run() const {
 	LOGD("run() calling " << function.target<FIBER_FUN_TEMPLATE_ARG>() << " ("
 												<< function.target_type().name() << ") with arg " << arg);
diff --git a/emper/Runtime.cpp b/emper/Runtime.cpp
index 0771fd61..282c3354 100644
--- a/emper/Runtime.cpp
+++ b/emper/Runtime.cpp
@@ -45,10 +45,8 @@
 #include <urcu.h>	 // for rcu_register_thread
 #endif
 
-#ifndef EMPER_LOG_OFF
 #include <syscall.h>	// for SYS_gettid
 #include <unistd.h>		// for syscall
-#endif
 
 std::mutex Runtime::currentRuntimeMutex;
 Runtime* Runtime::currentRuntime;
diff --git a/emper/io/IoContext.cpp b/emper/io/IoContext.cpp
index d1fec427..3e83d55b 100644
--- a/emper/io/IoContext.cpp
+++ b/emper/io/IoContext.cpp
@@ -12,6 +12,7 @@
 #include <cassert>	// for assert
 #include <cerrno>		// for errno, ECANCELED, EBUSY, EAGAIN, EINTR
 #include <cstring>	// for memset
+#include <ostream>	// for basic_osteram::operator<<, operator<<
 #include <utility>
 #include <vector>
 
@@ -27,10 +28,6 @@
 #include "io/Stats.hpp"	 // for Stats, nanoseconds
 #include "lib/TaggedPtr.hpp"
 
-#ifndef EMPER_LOG_OFF
-#include <ostream>	// for basic_osteram::operator<<, operator<<
-#endif
-
 using emper::lib::TaggedPtr;
 
 namespace emper::io {
diff --git a/emper/io/io.cpp b/emper/io/io.cpp
index 83c1abeb..48fb6293 100644
--- a/emper/io/io.cpp
+++ b/emper/io/io.cpp
@@ -7,16 +7,13 @@
 
 #include <cerrno>
 #include <cstring>
+#include <ostream>
 
 #include "Common.hpp"
 #include "Debug.hpp"
 #include "Fiber.hpp"
 #include "Runtime.hpp"
 
-#ifndef EMPER_LOG_OFF
-#include <ostream>
-#endif
-
 namespace emper::io {
 auto tcp_listener(std::string& host, std::string& port, const std::function<void(int)>& handler,
 									int backlog) -> Fiber* {
diff --git a/tests/SimpleActorTest.cpp b/tests/SimpleActorTest.cpp
index 76b4cfe3..e02da94c 100644
--- a/tests/SimpleActorTest.cpp
+++ b/tests/SimpleActorTest.cpp
@@ -8,16 +8,13 @@
 #include "Actor.hpp"										 // for Actor
 #include "CountingPrivateSemaphore.hpp"	 // for CPS
 #include "Debug.hpp"										 // for WDBG
+#include "Dispatcher.hpp"								 // for Dispatcher
 #include "Fiber.hpp"										 // for Fiber
 #include "Runtime.hpp"									 // for Runtime
 #include "emper-common.h"								 // for UNUSED_ARG
 #include "emper-config.h"								 // // IWYU pragma: keep
 #include "emper.hpp"										 // for spawn
 
-#ifndef EMPER_LOG_OFF
-#include "Dispatcher.hpp"	 // for Dispatcher
-#endif
-
 class SumActor : public Actor<uint64_t> {
  private:
 	uint64_t sum = 0;
-- 
GitLab