From c598c74ad029529c514383df87fb80c6e3a9e8a6 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Thu, 30 Jun 2022 13:48:48 +0200
Subject: [PATCH] rename debug-build define "DEBUG" to "_C8_DEBUG_" to avoid
 clash with logging

---
 cmake/corsikaDefines.cmake                       | 2 +-
 corsika/detail/framework/utility/CubicSolver.inl | 2 +-
 corsika/framework/core/Logging.hpp               | 2 +-
 examples/corsika.cpp                             | 2 +-
 examples/mars.cpp                                | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmake/corsikaDefines.cmake b/cmake/corsikaDefines.cmake
index 60cf7da9a..57673ca03 100644
--- a/cmake/corsikaDefines.cmake
+++ b/cmake/corsikaDefines.cmake
@@ -24,7 +24,7 @@ set (CMAKE_CXX_FLAGS_COVERAGE "-g --coverage")
 set (CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage")
 set (CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage")
 # set a flag to inform code that we are in debug mode
-set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
+set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_C8_DEBUG_")
 
 
 #+++++++++++++++++++++++++++++
diff --git a/corsika/detail/framework/utility/CubicSolver.inl b/corsika/detail/framework/utility/CubicSolver.inl
index 6baa0a39d..425bb85a3 100644
--- a/corsika/detail/framework/utility/CubicSolver.inl
+++ b/corsika/detail/framework/utility/CubicSolver.inl
@@ -254,7 +254,7 @@ namespace corsika {
 
     if (pre_opt.size()) {
       x1 = pre_opt[0]; //*std::max_element(pre_opt.begin(), pre_opt.end());
-#ifdef DEBUG
+#ifdef _C8_DEBUG_
       for (long double test_v : pre_opt) {
         CORSIKA_LOG_TRACE("test,andre x={} f(x)={}", test_v,
                           cubic_function(test_v, a, b, c, d));
diff --git a/corsika/framework/core/Logging.hpp b/corsika/framework/core/Logging.hpp
index 64fe792a6..dd58cc538 100644
--- a/corsika/framework/core/Logging.hpp
+++ b/corsika/framework/core/Logging.hpp
@@ -33,7 +33,7 @@
 #define SPDLOG_FUNCTION __PRETTY_FUNCTION__
 
 // if this is a Debug build, include debug messages in objects
-#ifdef DEBUG
+#ifdef _C8_DEBUG_
 // trace is the highest level of logging (ALL messages will be printed)
 #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
 #else // otherwise, remove everything but "error" and worse messages
diff --git a/examples/corsika.cpp b/examples/corsika.cpp
index ae3d3d0a1..fbff7d5db 100644
--- a/examples/corsika.cpp
+++ b/examples/corsika.cpp
@@ -177,7 +177,7 @@ int main(int argc, char** argv) {
     } else if (loglevel == "debug") {
       logging::set_level(logging::level::debug);
     } else if (loglevel == "trace") {
-#ifndef DEBUG
+#ifndef _C8_DEBUG_
       CORSIKA_LOG_ERROR("trace log level requires a Debug build.");
       return 1;
 #endif
diff --git a/examples/mars.cpp b/examples/mars.cpp
index e6d77b1cf..599e9c8da 100644
--- a/examples/mars.cpp
+++ b/examples/mars.cpp
@@ -200,7 +200,7 @@ int main(int argc, char** argv) {
   } else if (loglevel == "debug") {
     logging::set_level(logging::level::debug);
   } else if (loglevel == "trace") {
-#ifndef DEBUG
+#ifndef _C8_DEBUG_
     CORSIKA_LOG_ERROR("trace log level requires a Debug build.");
     return 1;
 #endif
-- 
GitLab