Skip to content

Commit

Permalink
clang-format: require semicolons on macros
Browse files Browse the repository at this point in the history
Forcing semicolons allows clang-format to properly format code using the
macros.
  • Loading branch information
kwrobot authored and mathstuf committed Nov 18, 2019
1 parent dda8b1c commit 5ec93e4
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Common/Core/vtkCommand.h
Expand Up @@ -369,7 +369,7 @@
NoEvent = 0,\
vtkAllEventsMacro() \
UserEvent = 1000\
};
}


// The superclass that all commands should be subclasses of
Expand Down
6 changes: 3 additions & 3 deletions Common/Core/vtkObjectFactory.h
Expand Up @@ -340,7 +340,7 @@ vtkObjectFactory* vtkLoad() \
} \
thisClass *result = new thisClass; \
result->InitializeObjectBase(); \
return result;
return result

// Macro to implement the body of the abstract object factory form of the New()
// method, i.e. an abstract base class that can only be instantiated if the
Expand All @@ -352,7 +352,7 @@ vtkObjectFactory* vtkLoad() \
return static_cast<thisClass*>(ret); \
} \
vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \
return nullptr;
return nullptr

// Macro to implement the body of the standard form of the New() method.
#if defined(VTK_ALL_NEW_OBJECT_FACTORY)
Expand All @@ -362,7 +362,7 @@ vtkObjectFactory* vtkLoad() \
# define VTK_STANDARD_NEW_BODY(thisClass) \
thisClass *result = new thisClass; \
result->InitializeObjectBase(); \
return result;
return result
#endif

// Macro to implement the standard form of the New() method.
Expand Down
20 changes: 10 additions & 10 deletions Common/Core/vtkSetGet.h
Expand Up @@ -560,13 +560,13 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
// vtkGenericWarningMacro(<< "this is debug info" << this->SomeVariable);
//
#define vtkGenericWarningMacro(x) \
{ if (vtkObject::GetGlobalWarningDisplay()) { \
do { if (vtkObject::GetGlobalWarningDisplay()) { \
vtkOStreamWrapper::EndlType endl; \
vtkOStreamWrapper::UseEndl(endl); \
vtkOStrStreamWrapper vtkmsg; \
vtkmsg << "" x; \
vtkOutputWindowDisplayGenericWarningText(__FILE__, __LINE__, vtkmsg.str()); \
vtkmsg.rdbuf()->freeze(0);}}
vtkmsg.rdbuf()->freeze(0);}} while (false)

//
// This macro is used for debug statements in instance methods
Expand Down Expand Up @@ -597,7 +597,7 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
// pointer properly
//
#define vtkErrorWithObjectMacro(self, x) \
{ \
do { \
if (vtkObject::GetGlobalWarningDisplay()) \
{ \
vtkOStreamWrapper::EndlType endl; \
Expand All @@ -618,7 +618,7 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
__FILE__, __LINE__, vtkmsg.str(), _object); \
vtkmsg.rdbuf()->freeze(0); vtkObject::BreakOnError(); \
} \
}
} while (false)

//
// This macro is used to print out warnings
Expand All @@ -628,7 +628,7 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
// pointer properly
//
#define vtkWarningWithObjectMacro(self, x) \
{ \
do { \
if (vtkObject::GetGlobalWarningDisplay()) \
{ \
vtkOStreamWrapper::EndlType endl; \
Expand All @@ -649,7 +649,7 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
__FILE__, __LINE__, vtkmsg.str(), _object); \
vtkmsg.rdbuf()->freeze(0); \
} \
}
} while (false)

/**
* This macro is used to print out debug message
Expand All @@ -659,10 +659,10 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
* pointer properly
*/
#ifdef NDEBUG
# define vtkDebugWithObjectMacro(self, x)
# define vtkDebugWithObjectMacro(self, x) do {} while (false)
#else
# define vtkDebugWithObjectMacro(self, x) \
{ \
do { \
vtkObject* _object = const_cast<vtkObject*>(static_cast \
<const vtkObject*>(self)); \
if ((!_object || _object->GetDebug()) && vtkObject::GetGlobalWarningDisplay()) \
Expand All @@ -682,7 +682,7 @@ extern VTKCOMMONCORE_EXPORT void vtkOutputWindowDisplayDebugText(const char*, in
vtkOutputWindowDisplayDebugText(__FILE__, __LINE__, vtkmsg.str(), _object); \
vtkmsg.rdbuf()->freeze(0); \
} \
}
} while (false)
#endif

//
Expand Down Expand Up @@ -955,7 +955,7 @@ virtual double *Get##name() VTK_SIZEHINT(2)\
vtkArrayIteratorTemplateMacroCase(VTK_SIGNED_CHAR, signed char, call); \
vtkArrayIteratorTemplateMacroCase(VTK_UNSIGNED_CHAR, unsigned char, call); \
vtkArrayIteratorTemplateMacroCase(VTK_STRING, vtkStdString, call); \
vtkTemplateMacroCase(VTK_BIT, vtkBitArrayIterator, call);
vtkTemplateMacroCase(VTK_BIT, vtkBitArrayIterator, call)

//----------------------------------------------------------------------------
// Setup legacy code policy.
Expand Down
2 changes: 1 addition & 1 deletion Common/Core/vtkType.h
Expand Up @@ -407,7 +407,7 @@ inline vtkTypeBool vtkDataTypesCompare(int a, int b)
decl<long>; \
decl<unsigned long>; \
decl<long long>; \
decl<unsigned long long>;
decl<unsigned long long>

/** A macro to declare extern templates for all numerical types */
#ifdef VTK_USE_EXTERN_TEMPLATE
Expand Down
2 changes: 1 addition & 1 deletion Common/Core/vtkVariant.h
Expand Up @@ -51,7 +51,7 @@
// This is same as Iterator Template macro with an additional case for VTK_VARIANT
#define vtkExtendedArrayIteratorTemplateMacro(call) \
vtkArrayIteratorTemplateMacro(call); \
vtkArrayIteratorTemplateMacroCase(VTK_VARIANT, vtkVariant, call);
vtkArrayIteratorTemplateMacroCase(VTK_VARIANT, vtkVariant, call)

class vtkStdString;
class vtkUnicodeString;
Expand Down
8 changes: 4 additions & 4 deletions Common/DataModel/vtkMappedUnstructuredGrid.h
Expand Up @@ -224,7 +224,7 @@ protected: \
private: \
_className(const _className&); \
void operator=(const _className&); \
};
}

#define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
class _exportDecl _className : \
Expand All @@ -245,7 +245,7 @@ protected: \
private: \
_className(const _className&); \
void operator=(const _className&); \
};
}

#else // __VTK_WRAP__

Expand All @@ -262,7 +262,7 @@ protected: \
private: \
_className(const _className&); \
void operator=(const _className&); \
};
}

#define vtkMakeExportedMappedUnstructuredGridWithIter(_className, _impl, _cIter, _exportDecl) \
class _exportDecl _className : \
Expand All @@ -277,7 +277,7 @@ protected: \
private: \
_className(const _className&); \
void operator=(const _className&); \
};
}

#endif // __VTK_WRAP__

Expand Down
2 changes: 1 addition & 1 deletion Rendering/ParallelLIC/vtkMPIPixelTT.h
Expand Up @@ -30,7 +30,7 @@ class vtkMPIPixelTT<_ctype> \
public: \
static MPI_Datatype MPIType; \
static int VTKType; \
};
}

vtkMPIPixelTTMacro1(void);
vtkMPIPixelTTMacro1(char);
Expand Down
2 changes: 1 addition & 1 deletion Wrapping/PythonCore/vtkPythonArgs.h
Expand Up @@ -964,7 +964,7 @@ PyObject *vtkPythonArgs::BuildBytes(const char *a, size_t n)
decl<long>; \
decl<unsigned long>; \
decl<long long>; \
decl<unsigned long long>;
decl<unsigned long long>

// Forward declare the Array class template over all types:
#if defined(VTK_USE_EXTERN_TEMPLATE) && !defined(vtkPythonArgs_cxx)
Expand Down

0 comments on commit 5ec93e4

Please sign in to comment.