Skip to content

Commit af4f655

Browse files
committed
COMP: Use C++11 noexcept directly
git grep -l \"ITK_NOEXCEPT\" | fgrep -v itk_compiler_detection.h | fgrep -v itkMacro.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | xargs sed -i '' -e \"s/ ITK_NOEXCEPT/ noexcept/g\" Change-Id: Ib5ae7fd446443b41016a5b3518a38dc59da73724
1 parent 10690f4 commit af4f655

30 files changed

Lines changed: 62 additions & 60 deletions

Modules/Core/Common/include/itkAutoPointer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class AutoPointer
191191

192192
/** Exchange the content of two AutoPointers */
193193
void Swap(AutoPointer & r)
194-
ITK_NOEXCEPT
194+
noexcept
195195
{
196196
ObjectType *temp = m_Pointer;
197197

Modules/Core/Common/include/itkDataObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ITKCommon_EXPORT DataObjectError:public ExceptionObject
5353
DataObjectError();
5454

5555
/** Destructor. Need to specify empty throw() to avoid warnings. */
56-
~DataObjectError() ITK_NOEXCEPT override {}
56+
~DataObjectError() noexcept override {}
5757

5858
/** Constructor. Needed to ensure the exception object can be copied. */
5959
DataObjectError(const char *file, unsigned int lineNumber);
@@ -101,7 +101,7 @@ class ITKCommon_EXPORT InvalidRequestedRegionError:public DataObjectError
101101
InvalidRequestedRegionError();
102102

103103
/** Destructor. Need to specify empty throw() to avoid warnings. */
104-
~InvalidRequestedRegionError() ITK_NOEXCEPT override {}
104+
~InvalidRequestedRegionError() noexcept override {}
105105

106106
/** Constructor. Needed to ensure the exception object can be copied. */
107107
InvalidRequestedRegionError(const char *file, unsigned int lineNumber);

Modules/Core/Common/include/itkExceptionObject.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ITKCommon_EXPORT ExceptionObject:public std::exception
6464
ExceptionObject(const ExceptionObject & orig);
6565

6666
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
67-
~ExceptionObject() ITK_NOEXCEPT override;
67+
~ExceptionObject() noexcept override;
6868

6969
/** Assignment operator. */
7070
ExceptionObject & operator=(const ExceptionObject & orig);
@@ -103,7 +103,7 @@ class ITKCommon_EXPORT ExceptionObject:public std::exception
103103
virtual unsigned int GetLine() const;
104104

105105
/** Provide std::exception::what() implementation. */
106-
const char * what() const ITK_NOEXCEPT override;
106+
const char * what() const noexcept override;
107107

108108
private:
109109
/** \class ReferenceCounterInterface
@@ -183,7 +183,7 @@ class ITKCommon_EXPORT MemoryAllocationError:public ExceptionObject
183183
const std::string & loc):ExceptionObject(file, lineNumber, desc, loc) {}
184184

185185
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
186-
~MemoryAllocationError() ITK_NOEXCEPT override;
186+
~MemoryAllocationError() noexcept override;
187187

188188
const char * GetNameOfClass() const override
189189
{ return "MemoryAllocationError"; }
@@ -208,7 +208,7 @@ class ITKCommon_EXPORT RangeError:public ExceptionObject
208208
RangeError(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {}
209209

210210
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
211-
~RangeError() ITK_NOEXCEPT override;
211+
~RangeError() noexcept override;
212212

213213
const char * GetNameOfClass() const override
214214
{ return "RangeError"; }
@@ -240,7 +240,7 @@ class ITKCommon_EXPORT InvalidArgumentError:public ExceptionObject
240240
InvalidArgumentError(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {}
241241

242242
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
243-
~InvalidArgumentError() ITK_NOEXCEPT override;
243+
~InvalidArgumentError() noexcept override;
244244

245245
const char * GetNameOfClass() const override
246246
{ return "InvalidArgumentError"; }
@@ -265,7 +265,7 @@ class ITKCommon_EXPORT IncompatibleOperandsError:public ExceptionObject
265265
IncompatibleOperandsError(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {}
266266

267267
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
268-
~IncompatibleOperandsError() ITK_NOEXCEPT override;
268+
~IncompatibleOperandsError() noexcept override;
269269

270270
const char * GetNameOfClass() const override
271271
{ return "IncompatibleOperandsError"; }
@@ -299,7 +299,7 @@ class ITKCommon_EXPORT ProcessAborted:public ExceptionObject
299299
}
300300

301301
/** Virtual destructor needed for subclasses. Has to have empty throw(). */
302-
~ProcessAborted() ITK_NOEXCEPT override;
302+
~ProcessAborted() noexcept override;
303303

304304
const char * GetNameOfClass() const override
305305
{ return "ProcessAborted"; }

Modules/Core/Common/include/itkLightObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class ITKCommon_EXPORT LightObject
105105
virtual void Register() const;
106106

107107
/** Decrease the reference count (release by another object). */
108-
virtual void UnRegister() const ITK_NOEXCEPT;
108+
virtual void UnRegister() const noexcept;
109109

110110
/** Gets the reference count on this object. */
111111
virtual int GetReferenceCount() const

Modules/Core/Common/include/itkObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class ITKCommon_EXPORT Object:public LightObject
104104
void Register() const override;
105105

106106
/** Decrease the reference count (release by another object). */
107-
void UnRegister() const ITK_NOEXCEPT override;
107+
void UnRegister() const noexcept override;
108108

109109
/** Sets the reference count (use with care) */
110110
void SetReferenceCount(int) override;

Modules/Core/Common/include/itkSmartPointer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class SmartPointer
183183
if ( m_Pointer ) { m_Pointer->Register(); }
184184
}
185185

186-
void UnRegister() ITK_NOEXCEPT
186+
void UnRegister() noexcept
187187
{
188188
if ( m_Pointer ) { m_Pointer->UnRegister(); }
189189
}

Modules/Core/Common/include/itkSmartPointerForwardReference.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ SmartPointerForwardReference< T >
194194
template< typename T >
195195
void
196196
SmartPointerForwardReference< T >
197-
::UnRegister() ITK_NOEXCEPT
197+
::UnRegister() noexcept
198198
{
199199
if ( m_Pointer )
200200
{

Modules/Core/Common/include/itkVariableLengthVector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector
420420
* \throw None
421421
* \sa \c itk::swap()
422422
*/
423-
void Swap(Self & v) ITK_NOEXCEPT
423+
void Swap(Self & v) noexcept
424424
{
425425
itkAssertInDebugAndIgnoreInReleaseMacro(m_LetArrayManageMemory == v.m_LetArrayManageMemory);
426426
using std::swap;
@@ -435,7 +435,7 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector
435435
* \post `m_Data == nullptr`
436436
* \post Built object contains old \c v data.
437437
*/
438-
VariableLengthVector(Self && v) ITK_NOEXCEPT;
438+
VariableLengthVector(Self && v) noexcept;
439439

440440
/** C++11 Move assignement operator.
441441
* \pre \c v shall not be the same as the current object
@@ -445,7 +445,7 @@ class ITK_TEMPLATE_EXPORT VariableLengthVector
445445
* \post `m_Data == nullptr`
446446
* \post Current object contains old \c v data.
447447
*/
448-
Self & operator=(Self && v) ITK_NOEXCEPT;
448+
Self & operator=(Self && v) noexcept;
449449

450450
/** Constructor from an Expression Template vector.
451451
* \tparam TExpr1 Type of the left sub-expression
@@ -1332,7 +1332,7 @@ std::ostream & operator<<(std::ostream & os, const VariableLengthVector< TValue
13321332
*/
13331333
template <typename T>
13341334
inline
1335-
void swap(VariableLengthVector<T> &l_, VariableLengthVector<T> &r_) ITK_NOEXCEPT
1335+
void swap(VariableLengthVector<T> &l_, VariableLengthVector<T> &r_) noexcept
13361336
{
13371337
l_.Swap(r_);
13381338
}

Modules/Core/Common/include/itkVariableLengthVector.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ VariableLengthVector< TValue >
8989

9090
template< typename TValue >
9191
VariableLengthVector< TValue >
92-
::VariableLengthVector(Self && v) ITK_NOEXCEPT
92+
::VariableLengthVector(Self && v) noexcept
9393
: m_LetArrayManageMemory(v.m_LetArrayManageMemory)
9494
, m_Data (v.m_Data)
9595
, m_NumElements (v.m_NumElements)
@@ -102,7 +102,7 @@ VariableLengthVector< TValue >
102102
template< typename TValue >
103103
VariableLengthVector< TValue > &
104104
VariableLengthVector< TValue >
105-
::operator=(Self && v) ITK_NOEXCEPT
105+
::operator=(Self && v) noexcept
106106
{
107107
itkAssertInDebugAndIgnoreInReleaseMacro(&v != this);
108108

Modules/Core/Common/src/itkExceptionObject.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ExceptionObject::ReferenceCountedExceptionData:public ExceptionData, publi
103103

104104
/** Decrease the reference count (release by another object).
105105
* Delegates the counting to its LightObject superclass */
106-
void UnRegister() const ITK_NOEXCEPT override
106+
void UnRegister() const noexcept override
107107
{
108108
this->LightObject::UnRegister();
109109
}
@@ -155,7 +155,7 @@ ExceptionObject::ExceptionObject(const ExceptionObject & orig):
155155
// pointer.
156156
}
157157

158-
ExceptionObject::~ExceptionObject() ITK_NOEXCEPT
158+
ExceptionObject::~ExceptionObject() noexcept
159159
{
160160
// During destruction, the reference count of the
161161
// ReferenceCountedExceptionData will be decreased
@@ -295,7 +295,7 @@ ExceptionObject::GetLine() const
295295
}
296296

297297
const char *
298-
ExceptionObject::what() const ITK_NOEXCEPT
298+
ExceptionObject::what() const noexcept
299299
{
300300
const ExceptionData *const thisData = this->GetExceptionData();
301301

@@ -341,23 +341,23 @@ ::Print(std::ostream & os) const
341341
os << indent << std::endl;
342342
}
343343

344-
MemoryAllocationError::~MemoryAllocationError() ITK_NOEXCEPT
344+
MemoryAllocationError::~MemoryAllocationError() noexcept
345345
{
346346
}
347347

348-
RangeError::~RangeError() ITK_NOEXCEPT
348+
RangeError::~RangeError() noexcept
349349
{
350350
}
351351

352-
InvalidArgumentError::~InvalidArgumentError() ITK_NOEXCEPT
352+
InvalidArgumentError::~InvalidArgumentError() noexcept
353353
{
354354
}
355355

356-
IncompatibleOperandsError::~IncompatibleOperandsError() ITK_NOEXCEPT
356+
IncompatibleOperandsError::~IncompatibleOperandsError() noexcept
357357
{
358358
}
359359

360-
ProcessAborted::~ProcessAborted() ITK_NOEXCEPT
360+
ProcessAborted::~ProcessAborted() noexcept
361361
{
362362
}
363363

0 commit comments

Comments
 (0)