diff --git a/src/core/math/MathTrait.h b/src/core/math/MathTrait.h
index 1cdd826844f2209104409fbef2e37e2ab2162c69..3f333228957bd553f13d0bf9ad8ae60f985a454e 100644
--- a/src/core/math/MathTrait.h
+++ b/src/core/math/MathTrait.h
@@ -688,5 +688,7 @@ WALBERLA_CREATE_MATHTRAIT_SPECIALIZATION( long double   , long double   , long d
 /*! \endcond */
 //*************************************************************************************************
 
+#undef WALBERLA_CREATE_MATHTRAIT_SPECIALIZATION
+
 }
 }
diff --git a/src/core/math/Uint.h b/src/core/math/Uint.h
index ac880252073d3a58f8e4ed20e10acab59e55a4c6..fdfc8ca491490e8138fef4f07ae80c82342a1efc 100644
--- a/src/core/math/Uint.h
+++ b/src/core/math/Uint.h
@@ -138,6 +138,7 @@ static const uint8_t msbLookupTable[256] =
       0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
       msbLT(5), msbLT(6), msbLT(6), msbLT(7), msbLT(7), msbLT(7), msbLT(7),
       msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8), msbLT(8)
+#undef msbLT
 };
 
 //**********************************************************************************************************************
diff --git a/src/core/math/equation_system/EquationParser.cpp b/src/core/math/equation_system/EquationParser.cpp
index 477bc2e03a9d5f3e224afceb082019d935d49e62..a58be4bd796d1a9eb33c8e8f7f37c9aa1c3e4a3a 100644
--- a/src/core/math/equation_system/EquationParser.cpp
+++ b/src/core/math/equation_system/EquationParser.cpp
@@ -23,13 +23,21 @@
 #include "EquationParser.h"
 #include "Operator.h"
 #include "Variable.h"
+#include "core/math/Constants.h"
 
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/lexical_cast.hpp>
 #include <memory>
 
 
-#define E_VAL 2.71828182845904523536
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// PARSE UTIL
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#define THROW(msg, str, index) {\
+   std::stringstream ss;\
+   ss << (msg) << " -> [" << (str) << "] at [" << (index) << "]";\
+   throw std::runtime_error( ss.str() );\
+}
 
 namespace walberla {
 namespace math {
@@ -179,12 +187,12 @@ NodePtr EquationParser::parseFunction( const std::string& str, size_t& index ) c
    {
    case OP_FUNC_EXP:
       funcPtr = std::make_shared<Node>( OP_PROD );
-      funcPtr->left()  = std::make_shared<Node>( E_VAL  );
+      funcPtr->left()  = std::make_shared<Node>( M_E  );
       funcPtr->right() = nodePtr;
       return funcPtr;
    case OP_FUNC_LN:
       funcPtr = std::make_shared<Node>( OP_LOG );
-      funcPtr->right() = std::make_shared<Node>( E_VAL  );
+      funcPtr->right() = std::make_shared<Node>( M_E  );
       funcPtr->left()  = nodePtr;
       return funcPtr;
    case OP_FUNC_SQRT:
diff --git a/src/core/math/equation_system/EquationParser.h b/src/core/math/equation_system/EquationParser.h
index 97f937eec3c46f1946ebfdf97b160472af8892ed..e32287be8926f996fbb60073bd43eadf8b5d2506 100644
--- a/src/core/math/equation_system/EquationParser.h
+++ b/src/core/math/equation_system/EquationParser.h
@@ -26,16 +26,6 @@
 
 #include <sstream>
 
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// PARSE UTIL
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#define THROW(msg, str, index) {\
-   std::stringstream ss;\
-   ss << msg << " -> [" << str << "] at [" << index << "]";\
-   throw std::runtime_error( ss.str() );\
-}
-
 namespace walberla {
 namespace math {
 
diff --git a/src/core/singleton/Singleton.h b/src/core/singleton/Singleton.h
index 441a730c7e8dfae097317fda450101a71d1f1401..3522210b0d2c1b388c26b7d62ad26a08747851b8 100644
--- a/src/core/singleton/Singleton.h
+++ b/src/core/singleton/Singleton.h
@@ -1088,6 +1088,11 @@ private:
 //**********************************************************************************************************************
 
 
+#undef WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY
+#undef WALBERLA_JOIN
+#undef WALBERLA_DO_JOIN
+#undef WALBERLA_DO_JOIN2
+
 
 //======================================================================================================================
 //
diff --git a/src/core/uid/UIDGenerators.h b/src/core/uid/UIDGenerators.h
index d9c254d93986340ed079761a2951119e1d7d29c4..7c762b9a125f325bc90f909e070c2779d2f7b3a7 100644
--- a/src/core/uid/UIDGenerators.h
+++ b/src/core/uid/UIDGenerators.h
@@ -159,6 +159,7 @@ static const boost::uint8_t logBase2LookupTable[256] =
       0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
       logBase2LT(4), logBase2LT(5), logBase2LT(5), logBase2LT(6), logBase2LT(6), logBase2LT(6), logBase2LT(6),
       logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7), logBase2LT(7)
+#undef logBase2LT
 };
 
 template< typename UINT > size_t logBase2( UINT value ); // 1000 -> 3, 0010 -> 1, 0001 -> 0, etc.
diff --git a/src/cuda/FieldIndexing3D.impl.h b/src/cuda/FieldIndexing3D.impl.h
index 147396ac44832423d0b5989cecc68e68c3f074e3..bfb7b0edd99199fe9149935547f5035ea64cbd10 100644
--- a/src/cuda/FieldIndexing3D.impl.h
+++ b/src/cuda/FieldIndexing3D.impl.h
@@ -32,10 +32,6 @@
 #include <limits>
 #include <cmath>
 
-#define BLOCK_SIZE_X       uint_t( 32 )
-#define BLOCK_SIZE_Y       uint_t( 2 )
-#define BLOCK_SIZE_Z       uint_t( 2 )
-
 namespace walberla {
 namespace cuda {
 
@@ -43,7 +39,7 @@ namespace cuda {
 inline unsigned int iDivUp( unsigned int a, unsigned int b ) { return ( a + b - 1 ) / b; }
 
 
-dim3 FieldIndexing3DBase::preferredBlockDim_( BLOCK_SIZE_X, BLOCK_SIZE_Y, BLOCK_SIZE_Z );
+dim3 FieldIndexing3DBase::preferredBlockDim_( 32, 2, 2 );
 
 
 template< typename T>
diff --git a/src/cuda/Kernel.h b/src/cuda/Kernel.h
index 987e8e54e63f46c3162a97a32d876a1657c38d4f..44c8d9ab05f3c9938b12cde5059d422dc602e547 100644
--- a/src/cuda/Kernel.h
+++ b/src/cuda/Kernel.h
@@ -146,6 +146,8 @@ namespace cuda {
       CHECK_PARAMETER_FUNC(7)
       CHECK_PARAMETER_FUNC(8)
 
+      #undef CHECK_PARAMETER_FUNC
+
       template<typename T> bool checkParameter( uint_t n );
       //@}
       //****************************************************************************************************************
diff --git a/src/field/AccuracyEvaluation.h b/src/field/AccuracyEvaluation.h
index 4f6e40176bd85bf9db91aba8318ac6311f37bdf7..5c47ede7332d5cd308ab0b14455f7086878f5b41 100644
--- a/src/field/AccuracyEvaluation.h
+++ b/src/field/AccuracyEvaluation.h
@@ -459,5 +459,8 @@ makeAccuracyEvaluation( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/field/AccuracyEvaluationLinePlot.h b/src/field/AccuracyEvaluationLinePlot.h
index d2c1fcbe66019004261c61fa9d9ffc06d33376ea..949f76c3524533509afb24eca89c49f9fddd294f 100644
--- a/src/field/AccuracyEvaluationLinePlot.h
+++ b/src/field/AccuracyEvaluationLinePlot.h
@@ -692,5 +692,8 @@ makeAccuracyEvaluationLinePlotter( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_LINE_PLOT_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_ACCURACY_EVALUATION_LINE_PLOT_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/field/MassEvaluation.h b/src/field/MassEvaluation.h
index 3d8228751e7c4cee52c18f07cbfc29fa8e955278..5337443efc61f96f149e93398078cc5161662cbc 100644
--- a/src/field/MassEvaluation.h
+++ b/src/field/MassEvaluation.h
@@ -422,6 +422,10 @@ shared_ptr< MassEvaluation< DensityField_T, Filter_T > > makeMassEvaluation( con
 }
 
 
+#ifndef KEEP_WALBERLA_FIELD_MAKE_MASS_EVALUATION
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_SET_AND_RETURN
+#endif
 
 } // namespace field
 } // namespace walberla
diff --git a/src/field/StabilityChecker.h b/src/field/StabilityChecker.h
index 74b4470ed093b8dbd6ab7d1fdb2d74a182bb79be..db69a7fb677abf963dc9c71de7f0f2338912ee38 100644
--- a/src/field/StabilityChecker.h
+++ b/src/field/StabilityChecker.h
@@ -656,5 +656,8 @@ makeStabilityChecker( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_STABILITY_CHECKER_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_STABILITY_CHECKER_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/field/VolumetricFlowRateEvaluation.h b/src/field/VolumetricFlowRateEvaluation.h
index 1763ea0eb78585bb8588cb581869d027488f5680..72880e7a59b8916f2046699fc4e59b4e6afd29e0 100644
--- a/src/field/VolumetricFlowRateEvaluation.h
+++ b/src/field/VolumetricFlowRateEvaluation.h
@@ -639,5 +639,8 @@ makeVolumetricFlowRateEvaluation( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_VOLUMETRIC_FLOW_RATE_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_VOLUMETRIC_FLOW_RATE_EVALUATION_SET_AND_RETURN
+
 } // namespace field
 } // namespace walberla
diff --git a/src/gui/MainWindow/GuiUtil.cpp b/src/gui/MainWindow/GuiUtil.cpp
index 5a0324b26006fad2bbecf5653778244b80d18d31..9d1306798bc9af408bc4ceca574e22e64c60009c 100644
--- a/src/gui/MainWindow/GuiUtil.cpp
+++ b/src/gui/MainWindow/GuiUtil.cpp
@@ -32,9 +32,6 @@
 #include <cassert>
 
 
-#define _unused(x) ((void)x)
-
-
 namespace walberla {
 namespace gui {
 
@@ -56,7 +53,7 @@ QMimeData * createMimeDataFromPointer(void * p, const QString & role)
 
     int bytesWritten = s.writeRawData( ( const char * ) & p, int_c( sizeof( void * ) ) );
     WALBERLA_ASSERT_EQUAL( bytesWritten, sizeof( void*) );
-    _unused(bytesWritten);
+    WALBERLA_UNUSED(bytesWritten);
 
     data->setData( role, d );
 
@@ -76,7 +73,7 @@ void * getPointerFromMimeData(const QMimeData *data, const QString& type)
 
     int bytesRead = s.readRawData( (char*)&ptr, int_c( sizeof( void * ) ) );
     WALBERLA_ASSERT_EQUAL( bytesRead, sizeof(void*) );
-    _unused(bytesRead);
+    WALBERLA_UNUSED(bytesRead);
 
     return ptr;
 }
diff --git a/src/lbm/MassEvaluation.h b/src/lbm/MassEvaluation.h
index 737ebdd85abe3c9663f9bf721577c095f262c372..5a12f9c1329fb0f09bdcd81e92490919b5d7c274 100644
--- a/src/lbm/MassEvaluation.h
+++ b/src/lbm/MassEvaluation.h
@@ -21,6 +21,7 @@
 
 #pragma once
 
+#define KEEP_WALBERLA_FIELD_MAKE_MASS_EVALUATION
 #include "field/MassEvaluation.h"
 
 
@@ -286,5 +287,9 @@ makeMassEvaluation( const Config_T & config,
 
 
 
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_CONFIG_PARSER
+#undef WALBERLA_FIELD_MAKE_MASS_EVALUATION_SET_AND_RETURN
+#undef KEEP_WALBERLA_FIELD_MAKE_MASS_EVALUATION
+
 } // namespace lbm
 } // namespace walberla
diff --git a/src/lbm/refinement/LinearExplosion.h b/src/lbm/refinement/LinearExplosion.h
index 97bc1c59f624f6a21092b7edf9cc57fb7046aa82..c70b7befe7296d10b6d9caec91ded7d1532b3d4f 100644
--- a/src/lbm/refinement/LinearExplosion.h
+++ b/src/lbm/refinement/LinearExplosion.h
@@ -443,6 +443,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte
                   grad[i] = v - tmpField->get( min[i], f );
                }
 #endif
+#undef WALBERLA_LBM_REFINEMENT_EXPLOSION_EXCLUDE_EXTRAPOLATION
             }
 
 #define WALBERLA_LBM_REFINEMENT_EXPLOSION_CHEN_CORRECTION
@@ -453,6 +454,7 @@ void linearInterpolation( const cell_idx_t y, const cell_idx_t z, const CellInte
 
             grad = grad - cNorm * ( cNorm * grad );
 #endif
+#undef WALBERLA_LBM_REFINEMENT_EXPLOSION_CHEN_CORRECTION
 
             const auto xx = x + cell_idx_t(1);
             const auto yy = y + cell_idx_t(1);
diff --git a/src/pe/ccd/HashGrids.h b/src/pe/ccd/HashGrids.h
index 49c40b5ce0154261d9b7e3b9f714e6b957cc83f6..f3998e26b5aa3ac31d690dbffd64f0e4b0b438e1 100644
--- a/src/pe/ccd/HashGrids.h
+++ b/src/pe/ccd/HashGrids.h
@@ -45,8 +45,6 @@
 #include <pe/utility/BodyCast.h>
 #include <pe/raytracing/Intersects.h>
 
-#define BLOCKCELL_NORMAL_INDETERMINATE 3
-
 namespace walberla{
 namespace pe{
 
@@ -189,6 +187,8 @@ private:
       BodyID getRayIntersectingBody(const raytracing::Ray& ray, const AABB& blockAABB, real_t& t, Vec3& n,
                                     std::function<bool (const BodyID body)> isBodyVisibleFunc) const;
       
+      static const int BLOCKCELL_NORMAL_INDETERMINATE = 3;
+
       template<typename BodyTuple>
       BodyID getBodyIntersectionForBlockCell(const Vector3<int32_t>& blockCell,
                                              const int8_t cellNormalAxis, const int8_t cellNormalDir,