Commit 6eddc310 authored by Harald Scheirich's avatar Harald Scheirich
Browse files

ENH: Common macros for ignoring errors

this should be used sparingly, for example for ignoring errors from dependent packages
parent 159badd2
......@@ -72,4 +72,44 @@ case typeN: { using IMSTK_TT = type; call; }; break
(std::is_same<templateType, double>::value ? IMSTK_DOUBLE : \
(std::is_same<templateType, long long>::value ? IMSTK_LONG_LONG : \
(std::is_same<templateType, unsigned long long>::value ? IMSTK_UNSIGNED_LONG_LONG : 0))))))))))))
}
\ No newline at end of file
}
// See https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
// When adding new warnings remember to add the DISABLE_ macro
// for all three sections MSVC, GCC/CLANG, other
#if defined(_MSC_VER)
#define DISABLE_WARNING_PUSH __pragma(warning( push ))
#define DISABLE_WARNING_POP __pragma(warning( pop ))
#define DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber ))
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(4100)
#define DISABLE_WARNING_UNREFERENCED_FUNCTION DISABLE_WARNING(4505)
#define DISABLE_WARNING_HIDES_CLASS_MEMBER DISABLE_WARNING(4458)
#define DISABLE_WARNING_PADDING DISABLE_WARNING(4324)
// other warnings you want to deactivate...
// Not seen in msvc or not checked, fix when working with windows
#elif defined(__GNUC__) || defined(__clang__)
#define DO_PRAGMA(X) _Pragma(#X)
#define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
#define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
#define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(-Wunused - parameter)
#define DISABLE_WARNING_UNREFERENCED_FUNCTION DISABLE_WARNING(-Wunused - function)
// other warnings you want to deactivate...
// Not seen in gcc or not checked, fix when working with linux
#define DISABLE_WARNING_HIDES_CLASS_MEMBER
#define DISABLE_WARNING_PADDING
#else
#define DISABLE_WARNING_PUSH
#define DISABLE_WARNING_POP
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER
#define DISABLE_WARNING_UNREFERENCED_FUNCTION
#define DISABLE_WARNING_HIDES_CLASS_MEMBER
// other warnings you want to deactivate...
#endif
\ No newline at end of file
......@@ -21,10 +21,17 @@
#include "imstkLinearFEMForceModel.h"
#include "imstkMacros.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include <StVKElementABCDLoader.h>
#include <StVKStiffnessMatrix.h>
#include <tetMesh.h>
DISABLE_WARNING_POP
namespace imstk
{
LinearFEMForceModel::LinearFEMForceModel(std::shared_ptr<vega::VolumetricMesh> mesh,
......
......@@ -19,11 +19,18 @@
=========================================================================*/
#include "imstkMacros.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include "imstkStVKForceModel.h"
#include <StVKElementABCDLoader.h>
#include <tetMesh.h>
DISABLE_WARNING_POP
namespace imstk
{
StVKForceModel::StVKForceModel(std::shared_ptr<vega::VolumetricMesh> mesh,
......
......@@ -27,7 +27,6 @@
#include "imstkLogger.h"
#include "imstkNewtonSolver.h"
#include "imstkPointSet.h"
#include "imstkStVKForceModel.h"
#include "imstkTaskGraph.h"
#include "imstkTimeIntegrator.h"
#include "imstkTypes.h"
......@@ -35,16 +34,15 @@
#include "imstkVegaMeshIO.h"
#include "imstkVolumetricMesh.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include "imstkStVKForceModel.h"
#include <generateMassMatrix.h>
#include <generateMeshGraph.h>
#ifdef WIN32
#pragma warning( push )
#pragma warning( disable : 4458 )
#endif
#include <configFile.h>
#ifdef WIN32
#pragma warning( pop )
#endif
DISABLE_WARNING_POP
namespace imstk
{
......
......@@ -19,10 +19,11 @@
=========================================================================*/
#include "imstkLevelSetModel.h"
#include "imstkDataArray.h"
#include "imstkImageData.h"
#include "imstkLevelSetModel.h"
#include "imstkLogger.h"
#include "imstkMacros.h"
#include "imstkParallelFor.h"
#include "imstkTaskGraph.h"
......@@ -132,6 +133,8 @@ LevelSetModel::evolve()
{
baseIndexToImageIndex.push_back(iter->first);
}
DISABLE_WARNING_PUSH
DISABLE_WARNING_PADDING
// Compute gradients
const double constantVel = m_config->m_constantVelocity;
......@@ -197,7 +200,7 @@ LevelSetModel::evolve()
}
}, noteUpdatePoolSize > m_maxVelocitiesParallel);
}
DISABLE_WARNING_POP
m_nodesToUpdate.clear();
}
else
......
......@@ -26,7 +26,7 @@ limitations under the License.
namespace imstk
{
SPHBoundaryConditions::SPHBoundaryConditions(std::pair<Vec3d, Vec3d>& inletCoords, std::vector<std::pair<Vec3d, Vec3d>>& outletCoords, std::pair<Vec3d, Vec3d>& fluidCoords,
const Vec3d& inletNormal, const StdVectorOfVec3d& outletNormals, const Real inletRadius, const Vec3d& inletCenterPt, const double inletFlowRate,
const Vec3d& inletNormal, const StdVectorOfVec3d&, const Real inletRadius, const Vec3d& inletCenterPt, const double inletFlowRate,
StdVectorOfVec3d& mainParticlePositions, const StdVectorOfVec3d& wallParticlePositions) :
m_inletDomain(inletCoords), m_outletDomain(outletCoords),
m_fluidDomain(fluidCoords),
......
......@@ -19,15 +19,21 @@
=========================================================================*/
#include "imstkVegaMeshIO.h"
#include "imstkHexahedralMesh.h"
#include "imstkLogger.h"
#include "imstkMacros.h"
#include "imstkTetrahedralMesh.h"
#include "imstkVecDataArray.h"
#include "imstkVegaMeshIO.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include <tetMesh.h>
#include <volumetricMeshLoader.h>
DISABLE_WARNING_POP
namespace imstk
{
std::shared_ptr<VolumetricMesh>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment