Commit c1b20f65 authored by Sean McBride's avatar Sean McBride

Applied a subset of clang-tidy’s misc-macro-parentheses fixes

parent c022231c
......@@ -610,10 +610,10 @@ static int TestColorConvert(const Triple &rgb, const Triple &hsv,
double *result2;
#define COMPARE(testname, target, dest) \
if (target != dest) \
if ((target) != (dest)) \
{ \
vtkGenericWarningMacro(<< "Incorrect " #testname " conversion. Got " \
<< dest << " expected " << target); \
<< (dest) << " expected " << (target)); \
return 0; \
}
......
......@@ -113,7 +113,7 @@ bool testCellIterator(vtkCellIterator *iter, vtkUnstructuredGrid *grid)
if (std::string(#className_) != std::string(iter->GetClassName())) \
{ \
cerr << "Unexpected iterator type (expected " #className_ ", got " \
<< iter_->GetClassName() << ")" << endl; \
<< (iter_)->GetClassName() << ")" << endl; \
return false; \
} \
\
......
......@@ -21,11 +21,11 @@
// Note that this may evaluate args twice. Use wisely.
#define TEST_ASSERT_FUZZY_EQUAL(expect, actual) \
if (std::fabs(expect - actual) >= 1e-5) \
if (std::fabs((expect) - (actual)) >= 1e-5) \
{ \
std::cerr << "Error at line " << __LINE__ \
<< ": Expected value " << expect << ", got " \
<< actual << "\n"; \
<< ": Expected value " << (expect) << ", got " \
<< (actual) << "\n"; \
return EXIT_FAILURE; \
}
......
......@@ -65,7 +65,7 @@ Point indices: Face indices:
#define CORNERS 8
#define EDGES 12
#define FACES 6
#define NPOINTS CORNERS+EDGES+FACES
#define NPOINTS (CORNERS+EDGES+FACES)
const int Faces[FACES][8] =
{
......
......@@ -79,7 +79,7 @@ bool vtkPolygon::IsConvex()
this->GetPointIds()->GetPointer(0));
}
#define VTK_POLYGON_FAILURE -1
#define VTK_POLYGON_FAILURE (-1)
#define VTK_POLYGON_OUTSIDE 0
#define VTK_POLYGON_INSIDE 1
#define VTK_POLYGON_INTERSECTION 2
......
......@@ -118,9 +118,9 @@ int TestCountFaces(int, char*[])
#define TEST_FACES(idx, expected) \
{ \
vtkIdType numFaces = faces->GetTypedComponent(idx, 0); \
if (numFaces != expected) \
if (numFaces != (expected)) \
{ \
std::cerr << "Expected cell @idx=" << idx << " to have " << expected \
std::cerr << "Expected cell @idx=" << (idx) << " to have " << (expected) \
<< " faces, but found " << numFaces << "\n"; \
return EXIT_FAILURE; \
} \
......
......@@ -118,9 +118,9 @@ int TestCountVertices(int, char*[])
#define TEST_VERTICES(idx, expected) \
{ \
vtkIdType numVerts = verts->GetTypedComponent(idx, 0); \
if (numVerts != expected) \
if (numVerts != (expected)) \
{ \
std::cerr << "Expected cell @idx=" << idx << " to have " << expected \
std::cerr << "Expected cell @idx=" << (idx) << " to have " << (expected) \
<< " vertices, but found " << numVerts<< "\n"; \
return EXIT_FAILURE; \
} \
......
......@@ -145,13 +145,13 @@ vtkSmartPointer<vtkPolyData> GeneratePolyData()
myp_##vtkArrayType->SetNumberOfTuples(nPoints); \
{ \
dataType tuple[nComponents]; \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] = value; \
} \
for (vtkIdType i=0;i<nPoints;i++) \
{ \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] += 1; \
} \
......@@ -170,13 +170,13 @@ vtkSmartPointer<vtkPolyData> GeneratePolyData()
myc_##vtkArrayType->SetNumberOfTuples(nCells); \
{ \
dataType tuple[nComponents]; \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] = value; \
} \
for (vtkIdType i=0;i<nCells;i++) \
{ \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] += 1; \
} \
......
......@@ -77,17 +77,17 @@ vtkPythonAlgorithm::~vtkPythonAlgorithm()
// function using the macro should return. Pass in a
// block comment /**/ for void functions using this macro
#define VTK_GET_METHOD(var, obj, method, failValue) \
if (!obj) \
{ \
if (!(obj)) \
{ \
return failValue; \
} \
} \
vtkSmartPyObject var(PyObject_GetAttrString(obj, method)); \
if (!var) \
{ \
if (!(var)) \
{ \
return failValue; \
} \
} \
if (!PyCallable_Check(var)) \
{ \
{ \
return failValue; \
}
......
......@@ -7,11 +7,11 @@
//#undef VTK_EXO_DBG_CACHE
#define VTK_EXO_PRT_KEY( ckey ) \
"(" << ckey.Time << ", " << ckey.ObjectType << ", " << ckey.ObjectId << ", " << ckey.ArrayId << ")"
"(" << (ckey).Time << ", " << (ckey).ObjectType << ", " << (ckey).ObjectId << ", " << (ckey).ArrayId << ")"
#define VTK_EXO_PRT_ARR( cval ) \
" [" << cval << "," << (cval ? cval->GetActualMemorySize() / 1024. : 0.) << "/" << this->Size << "/" << this->Capacity << "]"
" [" << (cval) << "," << ((cval) ? (cval)->GetActualMemorySize() / 1024. : 0.) << "/" << this->Size << "/" << this->Capacity << "]"
#define VTK_EXO_PRT_ARR2( cval ) \
" [" << cval << ", " << (cval ? cval->GetActualMemorySize() / 1024. : 0.) << "]"
" [" << (cval) << ", " << ((cval) ? (cval)->GetActualMemorySize() / 1024. : 0.) << "]"
#if 0
static void printCache( vtkExodusIICacheSet& cache, vtkExodusIICacheLRU& lru )
......
......@@ -32,14 +32,14 @@
#include <sstream>
#define TEST_SET_GET_VALUE( variable, command ) \
if( variable != command ) \
{ \
std::cout << "Error in " << #command << std::endl; \
std::cout << " In " __FILE__ ", line " << __LINE__ << std::endl; \
std::cout << "Expected |" << variable << "|" << std::endl; \
std::cout << "but got |" << command << "|" << std::endl; \
status += 1; \
#define TEST_SET_GET_VALUE( variable, command ) \
if( (variable) != (command) ) \
{ \
std::cout << "Error in " << #command << std::endl; \
std::cout << " In " __FILE__ ", line " << __LINE__ << std::endl; \
std::cout << "Expected |" << (variable) << "|" << std::endl; \
std::cout << "but got |" << (command) << "|" << std::endl; \
status += 1; \
}
static int TestRIBProperty();
......
......@@ -134,13 +134,13 @@ vtkSmartPointer<vtkPolyData> GeneratePolyData()
myp_##vtkArrayType->SetNumberOfTuples(nPoints); \
{ \
dataType tuple[nComponents]; \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] = value; \
} \
for (vtkIdType i=0;i<nPoints;i++) \
{ \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] += 1; \
} \
......@@ -159,13 +159,13 @@ vtkSmartPointer<vtkPolyData> GeneratePolyData()
myc_##vtkArrayType->SetNumberOfTuples(nCells); \
{ \
dataType tuple[nComponents]; \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] = value; \
} \
for (vtkIdType i=0;i<nCells;i++) \
{ \
for (vtkIdType j=0;j<nComponents;j++) \
for (vtkIdType j=0;j<(nComponents);j++) \
{ \
tuple[j] += 1; \
} \
......
......@@ -83,7 +83,7 @@ int TestOBJReaderRelative( int argc, char *argv[] )
}
#define CHECK_ARRAY_EXISTS(array) \
if (!array) \
if (!(array)) \
{ \
cerr << "Array does not exist." << endl; \
retVal = 1; \
......
......@@ -199,10 +199,10 @@ bool vtkMPASReader::Internal::isExtraDim(const string &name)
//----------------------------------------------------------------------------
#define CHECK_MALLOC(ptr) \
if (ptr == nullptr) \
{ \
vtkErrorMacro( << "malloc failed!" << endl); \
return(0); \
if ((ptr) == nullptr) \
{ \
vtkErrorMacro( << "malloc failed!" << endl); \
return(0); \
}
......@@ -211,7 +211,7 @@ bool vtkMPASReader::Internal::isExtraDim(const string &name)
//----------------------------------------------------------------------------
#define CHECK_DIM(ncFile, name) \
if (!isNcDim(ncFile, name)) \
if (!isNcDim(ncFile, name)) \
{ \
vtkErrorMacro( << "Cannot find dimension: " << name << endl); \
return 0; \
......@@ -221,8 +221,8 @@ bool vtkMPASReader::Internal::isExtraDim(const string &name)
// Macro to check if the named NetCDF variable exists
//----------------------------------------------------------------------------
#define CHECK_VAR(ncFile, name) \
if (!isNcVar(ncFile, name)) \
#define CHECK_VAR(ncFile, name) \
if (!isNcVar(ncFile, name)) \
{ \
vtkErrorMacro( << "Cannot find variable: " << name << endl); \
return 0; \
......
......@@ -317,7 +317,7 @@ vtkActor * vtkResliceCursorActor::GetCenterlineActor( int axis )
//----------------------------------------------------------------------
// Prints an object if it exists.
#define vtkPrintMemberObjectMacro( obj, os, indent ) \
os << indent << #obj << ": "; \
os << (indent) << #obj << ": "; \
if (this->obj) \
{ \
os << this->obj << "\n"; \
......
......@@ -2656,12 +2656,12 @@ int vtkScalarBarActor::PlaceAnnotationsHorizontally(
#define VTK_ANN_HLAYOUT(j, placer) \
this->P->AnnotationLabels[j]->GetTextProperty()\
->SetJustification(placer.Places[j].Justification); \
->SetJustification((placer).Places[j].Justification); \
this->P->AnnotationLabels[j]->GetTextProperty()\
->SetVerticalJustification(placer.Dir > 0 ? \
->SetVerticalJustification((placer).Dir > 0 ? \
VTK_TEXT_BOTTOM : VTK_TEXT_TOP); \
this->P->AnnotationLabels[j]->SetPosition(placer.Places[j].Anchor); \
placer.AddBrokenLeader(j, lpts, llines, llcolors, \
this->P->AnnotationLabels[j]->SetPosition((placer).Places[j].Anchor); \
(placer).AddBrokenLeader(j, lpts, llines, llcolors, \
this->P->AnnotationColors[j]);
int numNotes = static_cast<int>(this->P->AnnotationLabels.size());
......
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