Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wextra-semi #4699

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ StatementMacros:
- INTEL_PRAGMA_WARN_PUSH
- INTEL_PRAGMA_WARN_POP
- INTEL_SUPPRESS_warning_1292
- itkBooleanMacro
TabWidth: 2
UseTab: Never
...
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ITK_TEMPLATE_EXPORT VectorCentralDifferenceImageFunction
*/
itkSetMacro(UseImageDirection, bool);
itkGetConstMacro(UseImageDirection, bool);
itkBooleanMacro(UseImageDirection);
itkBooleanMacro(UseImageDirection)

protected:
VectorCentralDifferenceImageFunction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ITK_TEMPLATE_EXPORT ConicShellInteriorExteriorSpatialFunction
* set to false for the opposite direction. */
itkGetConstMacro(Polarity, bool);
itkSetMacro(Polarity, bool);
itkBooleanMacro(Polarity);
itkBooleanMacro(Polarity)

protected:
ConicShellInteriorExteriorSpatialFunction() = default;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkDataObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class ITK_FORCE_EXPORT_MACRO(ITKCommon) DataObject : public Object
}

itkGetConstReferenceMacro(ReleaseDataFlag, bool);
itkBooleanMacro(ReleaseDataFlag);
itkBooleanMacro(ReleaseDataFlag)

/** Turn on/off a flag to control whether every object releases its data
* after being used by a filter. Being a global flag, it controls the
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkFileOutputWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ class ITKCommon_EXPORT FileOutputWindow : public OutputWindow
/** Set/Get the buffer flushing mode */
itkSetMacro(Flush, bool);
itkGetConstMacro(Flush, bool);
itkBooleanMacro(Flush);
itkBooleanMacro(Flush)

/** Setting append will cause the log file to be
* opened in append mode. Otherwise, if the log file exists,
* it will be overwritten each time the FileOutputWindow
* is created. */
itkSetMacro(Append, bool);
itkGetConstMacro(Append, bool);
itkBooleanMacro(Append);
itkBooleanMacro(Append)

protected:
FileOutputWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperat
{
return m_NormalizeAcrossScale;
}
itkBooleanMacro(NormalizeAcrossScale);
itkBooleanMacro(NormalizeAcrossScale)

/** Set/Get the variance of the Gaussian kernel.
*
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkGaussianSpatialFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ITK_TEMPLATE_EXPORT GaussianSpatialFunction : public SpatialFunction<TOutp
/** Set/Get whether or not to normalize the Gaussian. Default is false. */
itkSetMacro(Normalized, bool);
itkGetConstMacro(Normalized, bool);
itkBooleanMacro(Normalized);
itkBooleanMacro(Normalized)

/** Set/Get the standard deviation in each direction. */
itkSetMacro(Sigma, ArrayType);
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkImageSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ class ITK_TEMPLATE_EXPORT ImageSource
* thus enabling custom region splitting methods. */
itkGetConstMacro(DynamicMultiThreading, bool);
itkSetMacro(DynamicMultiThreading, bool);
itkBooleanMacro(DynamicMultiThreading);
itkBooleanMacro(DynamicMultiThreading)

bool m_DynamicMultiThreading{};
};
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkImportImageContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class ITK_TEMPLATE_EXPORT ImportImageContainer : public Object
* \warning Improper use of these methods will result in memory leaks */
itkSetMacro(ContainerManageMemory, bool);
itkGetConstMacro(ContainerManageMemory, bool);
itkBooleanMacro(ContainerManageMemory);
itkBooleanMacro(ContainerManageMemory)

protected:
ImportImageContainer() = default;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkInPlaceImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ITK_TEMPLATE_EXPORT InPlaceImageFilter : public ImageToImageFilter<TInputI
* image type match. */
itkSetMacro(InPlace, bool);
itkGetConstMacro(InPlace, bool);
itkBooleanMacro(InPlace);
itkBooleanMacro(InPlace)

/** Can the filter run in place? To do so, the filter's first input
* and output must have the same dimension and pixel type. This
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkLightProcessObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ITKCommon_EXPORT LightProcessObject : public Object
itkGetConstReferenceMacro(AbortGenerateData, bool);

/** Turn on and off the AbortGenerateData flag. */
itkBooleanMacro(AbortGenerateData);
itkBooleanMacro(AbortGenerateData)

/** Set the execution progress of a process object. The progress is
* a floating number between (0,1), 0 meaning no progress; 1 meaning
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkOutputWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ITKCommon_EXPORT OutputWindow : public Object
* messages. */
itkSetMacro(PromptUser, bool);
itkGetConstMacro(PromptUser, bool);
itkBooleanMacro(PromptUser);
itkBooleanMacro(PromptUser)

protected:
OutputWindow();
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkProcessObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class ITKCommon_EXPORT ProcessObject : public Object
itkGetConstReferenceMacro(AbortGenerateData, bool);

/** \brief Turn on and off the AbortGenerateData flag. */
itkBooleanMacro(AbortGenerateData);
itkBooleanMacro(AbortGenerateData)

/** \deprecated
* Set the execution progress of a process object. The progress is
Expand Down Expand Up @@ -488,7 +488,7 @@ class ITKCommon_EXPORT ProcessObject : public Object
* utilization. Default value is on. */
itkSetMacro(ReleaseDataBeforeUpdateFlag, bool);
itkGetConstReferenceMacro(ReleaseDataBeforeUpdateFlag, bool);
itkBooleanMacro(ReleaseDataBeforeUpdateFlag);
itkBooleanMacro(ReleaseDataBeforeUpdateFlag)

/** Get/Set the number of work units to create when executing. */
itkSetClampMacro(NumberOfWorkUnits, ThreadIdType, 1, ITK_MAX_THREADS);
Expand Down Expand Up @@ -893,7 +893,7 @@ class ITKCommon_EXPORT ProcessObject : public Object
* updated in derived filters.
*/
itkGetConstMacro(ThreaderUpdateProgress, bool);
itkBooleanMacro(ThreaderUpdateProgress);
itkBooleanMacro(ThreaderUpdateProgress)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the ITK_MACRO_NOOP mechanism.

We want the ; colon here to keep the code consistent. It may be that the we need to update the itkMacro.h to get rid of these.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: ALSO ENSURE THAT "ITK_LEGACY_REMOVE" and ITK_FUTURE_LEGACY_REMOVE is turned on when running this flag for testing.

Copy link
Contributor

@seanm seanm May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the ; colon here to keep the code consistent.

You want the semi colon there? Even though you wouldn't if the macro's equivalent was written out by hand?

Example, itkBooleanMacro(ThreaderUpdateProgress) written manually would be:

  virtual void ThreaderUpdateProgressOn() { this->SetThreaderUpdateProgress(true); }
  virtual void ThreaderUpdateProgressOff() { this->SetThreaderUpdateProgress(false); }

which you wouldn't generally write as:

  virtual void ThreaderUpdateProgressOn() { this->SetThreaderUpdateProgress(true); }
  virtual void ThreaderUpdateProgressOff() { this->SetThreaderUpdateProgress(false); };

As this macro isn't a function-like (or statement-like) macro, it seems odd to end it with a semi.

virtual void
SetThreaderUpdateProgress(bool arg);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class ITK_TEMPLATE_EXPORT ShapedFloodFilledFunctionConditionalConstIterator : pu
bool
GetFullyConnected() const;

itkBooleanMacro(FullyConnected);
itkBooleanMacro(FullyConnected)

virtual const SeedsContainerType &
GetSeeds() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class ITK_TEMPLATE_EXPORT FiniteDifferenceImageFilter : public InPlaceImageFilte
/** Use the image spacing information in calculations. Use this option if you
* want derivatives in physical space. Default is UseImageSpacingOn. */
itkSetMacro(UseImageSpacing, bool);
itkBooleanMacro(UseImageSpacing);
itkBooleanMacro(UseImageSpacing)
itkGetConstReferenceMacro(UseImageSpacing, bool);

/** Set/Get the maximum error allowed in the solution. This may not be
Expand All @@ -206,7 +206,7 @@ class ITK_TEMPLATE_EXPORT FiniteDifferenceImageFilter : public InPlaceImageFilte
SetStateToUninitialized() */
itkSetMacro(ManualReinitialization, bool);
itkGetConstReferenceMacro(ManualReinitialization, bool);
itkBooleanMacro(ManualReinitialization);
itkBooleanMacro(ManualReinitialization)

itkSetMacro(IsInitialized, bool);
itkGetMacro(IsInitialized, bool);
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/GPUCommon/include/itkGPUImageToImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ITK_TEMPLATE_EXPORT GPUImageToImageFilter : public TParentImageFilter
// macro to set if GPU is used
itkSetMacro(GPUEnabled, bool);
itkGetConstMacro(GPUEnabled, bool);
itkBooleanMacro(GPUEnabled);
itkBooleanMacro(GPUEnabled)

void
GenerateData() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolateImageFunction : public InterpolateIm
*/
itkSetMacro(UseImageDirection, bool);
itkGetConstMacro(UseImageDirection, bool);
itkBooleanMacro(UseImageDirection);
itkBooleanMacro(UseImageDirection)

SizeType
GetRadius() const override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class ITK_TEMPLATE_EXPORT CentralDifferenceImageFunction : public ImageFunction<
*/
itkSetMacro(UseImageDirection, bool);
itkGetConstMacro(UseImageDirection, bool);
itkBooleanMacro(UseImageDirection);
itkBooleanMacro(UseImageDirection)

protected:
CentralDifferenceImageFunction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class ITK_TEMPLATE_EXPORT GaussianBlurImageFunction : public ImageFunction<TInpu
*/
itkSetMacro(UseImageSpacing, bool);
itkGetConstMacro(UseImageSpacing, bool);
itkBooleanMacro(UseImageSpacing);
itkBooleanMacro(UseImageSpacing)

protected:
GaussianBlurImageFunction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeImageFunction
this->RecomputeGaussianKernel();
}
}
itkBooleanMacro(UseImageSpacing);
itkBooleanMacro(UseImageSpacing)
itkGetMacro(UseImageSpacing, bool);

/** The variance for the discrete Gaussian kernel. Sets the variance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ITK_TEMPLATE_EXPORT ImageToParametricSpaceFilter : public ImageToMeshFilte
* an operator=(). Default value = true */
itkSetMacro(ComputeIndices, bool);
itkGetConstMacro(ComputeIndices, bool);
itkBooleanMacro(ComputeIndices);
itkBooleanMacro(ComputeIndices)

protected:
ImageToParametricSpaceFilter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class ITK_TEMPLATE_EXPORT ContourSpatialObject
/** Get if the contour is closed. */
itkGetConstMacro(IsClosed, bool);

itkBooleanMacro(IsClosed);
itkBooleanMacro(IsClosed)

/** Get the axis-normal orientation of the contour */
int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ITK_TEMPLATE_EXPORT ImageMaskSpatialObject : public ImageSpatialObject<TDi
itkSetMacro(MaskValue, PixelType);
itkGetConstReferenceMacro(MaskValue, PixelType);

itkBooleanMacro(UseMaskValue);
itkBooleanMacro(UseMaskValue)
itkSetMacro(UseMaskValue, bool);
itkGetConstReferenceMacro(UseMaskValue, bool);

Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/SpatialObjects/include/itkMetaConverterBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ITK_TEMPLATE_EXPORT MetaConverterBase : public Object
*/
itkSetMacro(WriteImagesInSeparateFile, bool);
itkGetConstMacro(WriteImagesInSeparateFile, bool);
itkBooleanMacro(WriteImagesInSeparateFile);
itkBooleanMacro(WriteImagesInSeparateFile)

protected:
MetaConverterBase() = default;
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/SpatialObjects/include/itkMetaSceneConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ITK_TEMPLATE_EXPORT MetaSceneConverter : public Object
/** Set if the points should be saved in binary/ASCII */
itkSetMacro(BinaryPoints, bool);
itkGetConstMacro(BinaryPoints, bool);
itkBooleanMacro(BinaryPoints);
itkBooleanMacro(BinaryPoints)

/** set/get the precision for writing out numbers as plain text */
itkSetMacro(TransformPrecision, unsigned int);
Expand All @@ -95,7 +95,7 @@ class ITK_TEMPLATE_EXPORT MetaSceneConverter : public Object
/** Set if the images should be written in different files */
itkSetMacro(WriteImagesInSeparateFile, bool);
itkGetConstMacro(WriteImagesInSeparateFile, bool);
itkBooleanMacro(WriteImagesInSeparateFile);
itkBooleanMacro(WriteImagesInSeparateFile)

/** add new SpatialObject/MetaObject converters at runtime
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ITK_TEMPLATE_EXPORT PolygonSpatialObject
/** Get if the contour is closed */
itkGetConstMacro(IsClosed, bool);

itkBooleanMacro(IsClosed);
itkBooleanMacro(IsClosed)

/** Method returns area of polygon described by points */
double
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ITK_TEMPLATE_EXPORT SpatialObjectToImageFilter : public ImageSource<TOutpu
* the ValueAtInWorldSpace() function instead of IsInsideInWorldSpace() */
itkSetMacro(UseObjectValue, bool);
itkGetConstMacro(UseObjectValue, bool);
itkBooleanMacro(UseObjectValue);
itkBooleanMacro(UseObjectValue)

protected:
SpatialObjectToImageFilter();
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/SpatialObjects/include/itkTubeSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ITK_TEMPLATE_EXPORT TubeSpatialObject : public PointBasedSpatialObject<TDi
/** Set the type of tube end-type: false = flat, true = rounded */
itkSetMacro(EndRounded, bool);
itkGetConstMacro(EndRounded, bool);
itkBooleanMacro(EndRounded);
itkBooleanMacro(EndRounded)

/** Compute the tangents and normals of the centerline of the tube. */
bool
Expand Down Expand Up @@ -108,7 +108,7 @@ class ITK_TEMPLATE_EXPORT TubeSpatialObject : public PointBasedSpatialObject<TDi
* tube network in the scene */
itkGetConstMacro(Root, bool);

itkBooleanMacro(Root);
itkBooleanMacro(Root)

/** Test whether a point is inside the object: returns true if the point is inside the tube, false otherwise.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class ITK_TEMPLATE_EXPORT PipelineMonitorImageFilter : public ImageToImageFilter
*/
itkSetMacro(ClearPipelineOnGenerateOutputInformation, bool);
itkGetMacro(ClearPipelineOnGenerateOutputInformation, bool);
itkBooleanMacro(ClearPipelineOnGenerateOutputInformation);
itkBooleanMacro(ClearPipelineOnGenerateOutputInformation)


/** This a meta verify method to check expected pipeline execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ITK_TEMPLATE_EXPORT ComparisonImageFilter : public ImageToImageFilter<TInp
*/
itkSetMacro(VerifyInputInformation, bool);
itkGetConstMacro(VerifyInputInformation, bool);
itkBooleanMacro(VerifyInputInformation);
itkBooleanMacro(VerifyInputInformation)

/** Set/Get the maximum distance away to look for a matching pixel.
Default is 0. */
Expand All @@ -93,7 +93,7 @@ class ITK_TEMPLATE_EXPORT ComparisonImageFilter : public ImageToImageFilter<TInp
* Default = false */
itkSetMacro(IgnoreBoundaryPixels, bool);
itkGetConstMacro(IgnoreBoundaryPixels, bool);
itkBooleanMacro(IgnoreBoundaryPixels);
itkBooleanMacro(IgnoreBoundaryPixels)

/** Get statistical attributes for those pixels which exceed the
* tolerance and radius parameters */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class ITK_TEMPLATE_EXPORT MRIBiasFieldCorrectionFilter : public ImageToImageFilt
* internally uses log intensity values for every calculation. */
itkSetMacro(BiasFieldMultiplicative, bool);
itkGetConstMacro(BiasFieldMultiplicative, bool);
itkBooleanMacro(BiasFieldMultiplicative);
itkBooleanMacro(BiasFieldMultiplicative)

#if defined(ITK_LEGACY_REMOVE)
/** If the bias field is multiplicative, it returns true. */
Expand All @@ -344,7 +344,7 @@ class ITK_TEMPLATE_EXPORT MRIBiasFieldCorrectionFilter : public ImageToImageFilt
* input images). */
itkSetMacro(UsingInterSliceIntensityCorrection, bool);
itkGetConstMacro(UsingInterSliceIntensityCorrection, bool);
itkBooleanMacro(UsingInterSliceIntensityCorrection);
itkBooleanMacro(UsingInterSliceIntensityCorrection)

/** Set/Get the slab correction flag. If the flag is true, inter-slice
* intensity correction and bias field correction will be performed slab by
Expand All @@ -353,7 +353,7 @@ class ITK_TEMPLATE_EXPORT MRIBiasFieldCorrectionFilter : public ImageToImageFilt
* should be buffered. */
itkSetMacro(UsingSlabIdentification, bool);
itkGetConstMacro(UsingSlabIdentification, bool);
itkBooleanMacro(UsingSlabIdentification);
itkBooleanMacro(UsingSlabIdentification)

itkSetMacro(SlabBackgroundMinimumThreshold, InputImagePixelType);
itkGetConstReferenceMacro(SlabBackgroundMinimumThreshold, InputImagePixelType);
Expand All @@ -371,13 +371,13 @@ class ITK_TEMPLATE_EXPORT MRIBiasFieldCorrectionFilter : public ImageToImageFilt
* is true). */
itkSetMacro(UsingBiasFieldCorrection, bool);
itkGetConstMacro(UsingBiasFieldCorrection, bool);
itkBooleanMacro(UsingBiasFieldCorrection);
itkBooleanMacro(UsingBiasFieldCorrection)

/** Set/Get the flag. If the flag is true, the output image (corrected image)
* will be created when this filter is updated (default value is true). */
itkSetMacro(GeneratingOutput, bool);
itkGetConstMacro(GeneratingOutput, bool);
itkBooleanMacro(GeneratingOutput);
itkBooleanMacro(GeneratingOutput)

/** Sets the direction of slicing.
* 0 - x axis, 1 - y axis, 2 - z axis */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ITK_TEMPLATE_EXPORT N4BiasFieldCorrectionImageFilter : public ImageToImage
* Defaults to false. */
itkSetMacro(UseMaskLabel, bool);
itkGetConstMacro(UseMaskLabel, bool);
itkBooleanMacro(UseMaskLabel);
itkBooleanMacro(UseMaskLabel)

/**
* Set confidence image function. If a confidence image is specified,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ITK_TEMPLATE_EXPORT BinaryClosingByReconstructionImageFilter
*/
itkSetMacro(FullyConnected, bool);
itkGetConstReferenceMacro(FullyConnected, bool);
itkBooleanMacro(FullyConnected);
itkBooleanMacro(FullyConnected)

protected:
BinaryClosingByReconstructionImageFilter();
Expand Down
Loading