//=========================================================================
//
//  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 macOS with cppcheck 1.78.

// 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 many/all.  Can look again one day.
// 2364 warnings
variableScope
// 1109 warnings
uninitMemberVar
// 231 warnings
cstyleCast
// 182 warnings
noExplicitConstructor
// 169 warnings
invalidscanf
// 137 warnings
unreadVariable
// 34 warnings
noCopyConstructor
// 20 warnings
useInitializationList
// 18 warnings
redundantAssignment:Filters/General/vtkBoxClipDataSet.cxx
redundantAssignment:*/Testing/*

// Gives too many false positives.
assertWithSideEffect
argumentSize

// False positives.
AssignmentAddressToInteger:Common/Math/vtkPolynomialSolversUnivariate.cxx
AssignmentAddressToInteger:IO/Exodus/vtkExodusIIReader.cxx
CastIntegerToAddressAtReturn:Geovis/Core/vtkGeoTreeNode.h
copyCtorPointerCopying:IO/NetCDF/vtkSLACReader.cxx
duplicateExpression:Rendering/Annotation/vtkScalarBarActor.cxx
memleak:Examples/Infovis/Cxx/MultiView.cxx
memleak:IO/Image/vtkJPEGReader.cxx
memleak:Imaging/Hybrid/vtkSurfaceReconstructionFilter.cxx
multiCondition:Filters/Matlab/vtkMatlabMexAdapter.cxx
operatorEqVarError:Filters/General/vtkHyperStreamline.cxx
redundantAssignment:Wrapping/Tcl/vtkTclUtil.cxx
redundantAssignment:Wrapping/Tools/vtkParsePreprocess.c
stlIfStrFind:Infovis/Core/vtkPipelineGraphSource.cxx
stlIfStrFind:Rendering/OpenGL2/vtkOpenGLRenderer.cxx
unsafeClassCanLeak:Filters/General/vtkDensifyPolyData.cxx
unsafeClassCanLeak:GUISupport/Qt/QVTKInteractorInternal.h
unsafeClassCanLeak:Interaction/Widgets/vtkBiDimensionalRepresentation.h
unusedLabelSwitch:IO/Exodus/vtkCPExodusIINodalCoordinatesTemplate.txx
uselessAssignmentArg:Common/DataModel/vtkReebGraph.cxx
uselessAssignmentPtrArg:Wrapping/Tools/vtkParse.tab.c

// false positive: <http://trac.cppcheck.net/ticket/7878>
bufferAccessOutOfBounds:IO/Xdmf3/Testing/Cxx/TestXdmf3Parallel.cxx

// false positive: <http://trac.cppcheck.net/ticket/7888>
knownConditionTrueFalse:Common/Core/Testing/Cxx/UnitTestMath.cxx

// false positive: <http://trac.cppcheck.net/ticket/7889>
knownConditionTrueFalse:IO/Parallel/vtkMultiBlockPLOT3DReader.cxx
knownConditionTrueFalse:Parallel/MPI/Testing/Cxx/ExerciseMultiProcessController.cxx

// false positive: <http://trac.cppcheck.net/ticket/7890>
knownConditionTrueFalse:IO/LSDyna/vtkLSDynaReader.cxx
knownConditionTrueFalse:Rendering/Annotation/vtkScalarBarActor.cxx
knownConditionTrueFalse:Rendering/Volume/vtkFixedPointVolumeRayCastMIPHelper.cxx

// false positive: <http://trac.cppcheck.net/ticket/7896>
unassignedVariable:Common/Transforms/vtkHomogeneousTransform.cxx
unassignedVariable:Rendering/Core/vtkCamera.cxx

// Not worth fixing, but not actually false positives.
duplicateExpression:Common/Math/Testing/Cxx/TestPolynomialSolversUnivariate.cxx
knownConditionTrueFalse:GUISupport/Qt/QVTKWidget.cxx
knownConditionTrueFalse:Rendering/OpenGL/vtkXGPUInfoList.cxx
passedByValue:Filters/General/vtkYoungsMaterialInterface.cxx
knownConditionTrueFalse:IO/XML/Testing/Cxx/TestHyperOctreeIO.cxx
knownConditionTrueFalse:Rendering/OSPRay/vtkOSPRayRendererNode.cxx

// There are a fair number of these, but they are probably worth working through.
// 16 warnings
invalidPointerCast:Rendering/GL2PSOpenGL2/vtkOpenGLGL2PSHelperImpl.cxx
invalidPointerCast:Rendering/OSPRay/vtkOSPRayPolyDataMapperNode.cxx
invalidPointerCast:Rendering/OpenGL2/vtkOpenGLSphereMapper.cxx
invalidPointerCast:Rendering/OpenGL2/vtkOpenGLStickMapper.cxx
invalidPointerCast:Rendering/OpenGL2/vtkOpenGLVertexBufferObject.cxx
invalidPointerCast:Rendering/ParallelLIC/vtkParallelTimer.cxx
// 14 warnings
copyCtorAndEqOperator

// 6 warnings
noConstructor:Common/Core/Testing/Cxx/TestCxxFeatures.cxx
noConstructor:Common/Core/Testing/Cxx/TestDataArrayIterators.cxx
noConstructor:Common/Core/vtkTypeList.txx
noConstructor:Filters/ParallelDIY2/vtkPResampleWithDataSet.cxx
noConstructor:Rendering/Core/Testing/Cxx/TestInteractorTimers.cxx
noConstructor:Examples/GUI/Win32/vtkMFC/vtkSDI/vtkSDIView.h

// Need someone that knows this code...
memleak:Wrapping/Tools/vtkParsePreprocess.c
nullPointerRedundantCheck:IO/Exodus/vtkExodusIIReaderParser.cxx
redundantAssignment:IO/Image/vtkJPEGReader.cxx
knownConditionTrueFalse:IO/Exodus/vtkExodusIIWriter.cxx
knownConditionTrueFalse:Rendering/Label/vtkLabeledTreeMapDataMapper.cxx
knownConditionTrueFalse:Filters/ParallelFlowPaths/Testing/Cxx/TestPStreamGeometry.cxx
knownConditionTrueFalse:Rendering/Label/vtkLabelSizeCalculator.cxx
redundantAssignment:Rendering/OSPRay/vtkOSPRayRendererNode.cxx
