//=========================================================================
//
//  Program:   Visualization Toolkit
//
//  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
//  All rights reserved.
//  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
//
//     This software is distributed WITHOUT ANY WARRANTY; without even
//     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
//     PURPOSE.  See the above copyright notice for more information.
//
//=========================================================================

// This file contains enough suppressions to result in no cppcheck warnings,
// at least on Mac OS X with cppcheck 1.75.

// To run:
// cd /path/to/VTK/
// cppcheck --platform=unix64 --enable=style -q --suppressions-list=CMake/VTKcppcheckSuppressions.txt --template='{id},{file}:{line},{severity},{message}' -j8 .

// Suppress everything from ThirdParty.
*:ThirdParty/*

// Similarly, these aren't really part of VTK proper.
*:Utilities/KWSys/*
*:Utilities/MetaIO/*
*:Utilities/DICOMParser/*

// Can't fix in portable way for all VTK-supported platforms.
duplicateExpression:IO/PostgreSQL/vtkPostgreSQLQuery.cxx
unpreciseMathCall

// Using reallocf() would be a good solution, but it's not available on all platforms.
memleakOnRealloc

// VTK assumes IEEE 754 floats, so this warning isn't useful.
memsetClassFloat

// There are just too many of these to manage, so suppress them all.  Can look again one day.
// 2364 warnings
variableScope
// 1109 warnings
uninitMemberVar
// 231 warnings
cstyleCast
// 182 warnings
noExplicitConstructor
// 169 warnings
invalidscanf
// 137 warnings
unreadVariable
// 60 warnings
redundantAssignment
// 34 warnings
noCopyConstructor
// 20 warnings
useInitializationList

// Gives too many false positives.
assertWithSideEffect
argumentSize

// A regression between 1.73 and 1.74 results in lots of false positives for this warning
// <https://sourceforge.net/p/cppcheck/discussion/general/thread/21296d8f/?limit=25#6cab>
clarifyCondition:Filters/General/vtkContourTriangulator.cxx
clarifyCondition:Imaging/Core/vtkImageStencilData.cxx
clarifyCondition:Imaging/Stencil/vtkPolyDataToImageStencil.cxx
clarifyCondition:IO/ODBC/vtkODBCQuery.cxx
clarifyCondition:Rendering/OSPRay/Testing/Cxx/TestOSPRayRenderMesh.cxx

// False positives.
argumentSize:Common/DataModel/vtkAMRBox.cxx
argumentSize:Common/DataModel/vtkStructuredGrid.h
arrayIndexOutOfBounds:Common/DataModel/vtkCell.h
assignBoolToPointer:Common/Math/vtkMatrix4x4.h
AssignmentAddressToInteger:Common/Math/vtkPolynomialSolversUnivariate.cxx
CastIntegerToAddressAtReturn:Geovis/Core/vtkGeoTreeNode.h
clarifyCondition:Rendering/Core/Testing/Cxx/TestInteractorStyleImageProperty.cxx
comparisonOfBoolWithInvalidComparator:Rendering/Label/vtkLabeledTreeMapDataMapper.cxx
copyCtorPointerCopying:IO/NetCDF/vtkSLACReader.cxx
deallocDealloc:Wrapping/Tools/vtkParseMerge.c
duplicateExpression:Common/Math/Testing/Cxx/TestPolynomialSolversUnivariate.cxx
duplicateExpression:Filters/General/vtkContourTriangulator.cxx
duplicateExpression:Filters/General/vtkVoxelContoursToSurfaceFilter.cxx
duplicateExpression:Rendering/Annotation/vtkScalarBarActor.cxx
invalidPrintfArgType_int:Wrapping/PythonCore/vtkPythonUtil.cxx
knownConditionTrueFalse:Common/Core/Testing/Cxx/TestDataArrayIterators.cxx
memleak:Common/Core/Testing/Cxx/TestGarbageCollector.cxx
memleak:Examples/Infovis/Cxx/MultiView.cxx
memleak:Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx
memleak:IO/Image/vtkJPEGReader.cxx
multiCondition:Filters/Matlab/vtkMatlabMexAdapter.cxx
negativeIndex:Common/DataModel/vtkPerlinNoise.cxx
nullPointer:Interaction/Style/vtkInteractorStyleJoystickActor.cxx
nullPointer:Interaction/Style/vtkInteractorStyleTrackballActor.cxx
nullPointer:IO/Exodus/vtkExodusIIReaderParser.cxx
nullPointerRedundantCheck:Filters/General/vtkMultiThreshold.cxx
operatorEqVarError:Filters/General/vtkHyperStreamline.cxx
oppositeInnerCondition:Rendering/VolumeOpenGL/vtkOpenGLVolumeTextureMapper3D.cxx
pointerPositive:Common/DataModel/vtkUnstructuredGridCellIterator.cxx
redundantAssignInSwitch:Wrapping/Tools/vtkWrapPythonOverload.c
redundantAssignment:Filters/General/vtkApproximatingSubdivisionFilter.cxx
redundantAssignment:Filters/General/vtkInterpolatingSubdivisionFilter.cxx
redundantAssignment:Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx
redundantAssignment:Rendering/OpenGL2/vtkRenderbuffer.cxx
redundantAssignment:Rendering/OpenGL2/vtkTextureObject.cxx
redundantAssignment:Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx
stlIfStrFind:Infovis/Core/vtkPipelineGraphSource.cxx
stlIfStrFind:Rendering/OpenGL2/vtkOpenGLRenderer.cxx
unassignedVariable:Common/Transforms/vtkHomogeneousTransform.cxx
unassignedVariable:Filters/Core/vtkFlyingEdges3D.cxx
unassignedVariable:Rendering/Core/vtkCamera.cxx
uninitdata:IO/Import/vtk3DSImporter.cxx
uninitvar:Common/Transforms/vtkAbstractTransform.cxx
uninitvar:Common/Transforms/vtkHomogeneousTransform.cxx
uninitvar:Common/Transforms/vtkLinearTransform.cxx
uninitvar:Common/Transforms/vtkPerspectiveTransform.cxx
uninitvar:Common/Transforms/vtkTransform2D.cxx
uninitvar:Filters/SMP/vtkSMPTransform.cxx
uninitvar:IO/Exodus/vtkExodusIIReader.cxx
uninitvar:Rendering/ContextOpenGL2/vtkOpenGLContextDevice2D.cxx
uninitvar:Rendering/Core/vtkCamera.cxx
unsafeClassCanLeak:Filters/General/vtkDensifyPolyData.cxx
unsafeClassCanLeak:GUISupport/Qt/QVTKInteractorInternal.h
unsafeClassCanLeak:Interaction/Widgets/vtkBiDimensionalRepresentation.h
unusedAllocatedMemory:IO/Legacy/vtkDataWriter.cxx
unusedLabelSwitch:IO/Exodus/vtkCPExodusIINodalCoordinatesTemplate.txx
unusedStructMember:Common/Core/vtkTypeList.txx
unusedStructMember:Common/Misc/vtkHeap.cxx
unusedStructMember:IO/Image/vtkMRCReader.cxx
unusedStructMember:IO/Infovis/vtkTulipReader.cxx
uselessAssignmentArg:Common/DataModel/vtkReebGraph.cxx
uselessAssignmentPtrArg:Filters/General/vtkYoungsMaterialInterface.cxx
uselessAssignmentPtrArg:IO/Parallel/vtkPImageWriter.cxx
uselessAssignmentPtrArg:Wrapping/Tools/vtkParse.tab.c
zerodiv:Filters/ParallelFlowPaths/Testing/Cxx/TestPStreamGeometry.cxx

// Not worth fixing, but not actually false positives.
knownConditionTrueFalse:GUISupport/Qt/QVTKWidget.cxx
knownConditionTrueFalse:Rendering/OpenGL/vtkXGPUInfoList.cxx
passedByValue:Filters/General/vtkYoungsMaterialInterface.cxx

// There are a fair number of these, but they are probably worth working through.
// 217 warnings
postfixOperator
// 30 warnings
duplInheritedMember
// 12 warnings
invalidPointerCast
// 6 warnings
noConstructor

// To investigate further...
memleak:Wrapping/Tools/vtkParsePreprocess.c
nullPointerRedundantCheck:IO/Exodus/vtkExodusIIReaderParser.cxx
redundantAssignment:Filters/General/vtkBoxClipDataSet.cxx
redundantAssignment:Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx
redundantAssignment:Rendering/Volume/vtkGPUVolumeRayCastMapper.cxx:
