diff --git a/emper/BinaryPrivateSemaphore.cpp b/emper/BinaryPrivateSemaphore.cpp
index 65cb65c62b9a4627b2ce939a10f47ad981321ef2..2ed14d1825857ee96d2f9531ffa979845af885e3 100644
--- a/emper/BinaryPrivateSemaphore.cpp
+++ b/emper/BinaryPrivateSemaphore.cpp
@@ -7,6 +7,7 @@
 #include "Common.hpp"		// for unlikely
 #include "Context.hpp"	// for Context
 #include "Debug.hpp"		// for LOGDD
+#include "Emper.hpp"		// for emper::DEBUG
 
 void BinaryPrivateSemaphore::wait() {
 	State state = bpsState.load();
@@ -28,13 +29,13 @@ void BinaryPrivateSemaphore::wait() {
 		State newState = blocked;
 		State previousState = bpsState.exchange(newState);
 		if (previousState == signaled) {
-#ifndef NDEBUG
-			// Reset the real signal state only in debug
-			// builds. As it is not required to set the state here
-			// for the correctnes of the synchronization primitive.
-			newState = signaled;
-			bpsState.store(newState, std::memory_order_relaxed);
-#endif
+			if constexpr (emper::DEBUG) {
+				// Reset the real signal state only in debug
+				// builds. As it is not required to set the state here
+				// for the correctnes of the synchronization primitive.
+				newState = signaled;
+				bpsState.store(newState, std::memory_order_relaxed);
+			}
 			unblock(blockedContext);
 		}
 	});
@@ -48,13 +49,13 @@ auto BinaryPrivateSemaphore::signalInternal() -> Context* {
 	if (currentState != initial) {
 		// Fast path: If the state is not initial then someone is
 		// waiting, because the state can't be signaled.
-#ifndef NDEBUG
-		State newState = signaled;
-		// Reset the real signal state only in debug
-		// builds. As it is not required to set the state here
-		// for the correctnes of the synchronization primitive.
-		bpsState.store(newState);
-#endif
+		if constexpr (emper::DEBUG) {
+			State newState = signaled;
+			// Reset the real signal state only in debug
+			// builds. As it is not required to set the state here
+			// for the correctnes of the synchronization primitive.
+			bpsState.store(newState);
+		}
 		LOGDD("unblock in fast path");
 		return blockedContext;
 	}
diff --git a/emper/Context.hpp b/emper/Context.hpp
index a061b21dfd71874dad1dfbbcb55bb97a2919af36..e1bbd7ce279da074e14f529ce643afa2a2b20e71 100644
--- a/emper/Context.hpp
+++ b/emper/Context.hpp
@@ -4,6 +4,7 @@
 
 #include <cassert>			// for assert
 #include <cstdint>			// for uintptr_t
+#include <cstring>			// for memset
 #include <functional>		// for function
 #include <iosfwd>				// for ostream
 #include <type_traits>	// for remove_reference<>::type // IWYU pragma: keep
@@ -11,10 +12,7 @@
 
 #include "Common.hpp"	 // for func_t, DIE, ALIGN_TO_CACHE_LINE
 #include "Debug.hpp"	 // for LOGD, LogSubsystem, LogSubsystem::C, Logger
-
-#ifndef NDEBUG
-#include <cstring>	// for memset
-#endif
+#include "Emper.hpp"	 // for Emper::DEBUG
 
 class Fiber;
 
@@ -70,19 +68,19 @@ class ALIGN_TO_CACHE_LINE Context : Logger<LogSubsystem::C> {
 				mainFunction(std::move(std::move(mainFunction))) {
 		//		valgrindStackId = VALGRIND_STACK_REGISTER(context, context + CONTEXT_SI);
 
-#ifndef NDEBUG
-		// Write the stack full of 0xcc bytes, which just happen to be
-		// the 'int3' instruction, which will trigger a breakpoint
-		// when executed.
-		void* res = memset(context, 0xcc, (char*)tos - context);
-		if (!res) DIE;
-		// Mark the last valid 16 bytes just below the top of stack.
-		res = memset(((uintptr_t*)tos) - 1, 0xab, sizeof(uintptr_t));
-		if (!res) DIE;
-		// Mark the eventually existing unused top stack bytes
-		res = memset(tos, 0xee, &context[CONTEXT_SIZE] - (char*)tos);
-		if (!res) DIE;
-#endif
+		if constexpr (emper::DEBUG) {
+			// Write the stack full of 0xcc bytes, which just happen to be
+			// the 'int3' instruction, which will trigger a breakpoint
+			// when executed.
+			void* res = memset(context, 0xcc, (char*)tos - context);
+			if (!res) DIE;
+			// Mark the last valid 16 bytes just below the top of stack.
+			res = memset(((uintptr_t*)tos) - 1, 0xab, sizeof(uintptr_t));
+			if (!res) DIE;
+			// Mark the eventually existing unused top stack bytes
+			res = memset(tos, 0xee, &context[CONTEXT_SIZE] - (char*)tos);
+			if (!res) DIE;
+		}
 
 		setEmptyHook();