Skip to content

Commit

Permalink
STYLE: Replace Unused calls with C++17 [[maybe_unused]] attribute
Browse files Browse the repository at this point in the history
Removed `Unused(singletonIndex)` calls. Instead, added `[[maybe_unused]]` to
`singletonIndex` variable declarations.
  • Loading branch information
N-Dekker authored and dzenanz committed Nov 8, 2023
1 parent fed6ed0 commit a28242a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Modules/Core/Common/include/itkSingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ template <typename T>
T *
Singleton(const char * globalName, std::function<void()> deleteFunc)
{
static SingletonIndex * singletonIndex = SingletonIndex::GetInstance();
Unused(singletonIndex);
T * instance = SingletonIndex::GetInstance()->GetGlobalInstance<T>(globalName);
[[maybe_unused]] static SingletonIndex * singletonIndex = SingletonIndex::GetInstance();
T * instance = SingletonIndex::GetInstance()->GetGlobalInstance<T>(globalName);
if (instance == nullptr)
{
instance = new T;
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Common/src/itkObjectFactoryBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,7 @@ ObjectFactoryBase::SynchronizeObjectFactoryBase(void * objectFactoryBasePrivate)
std::list<ObjectFactoryBase *>
ObjectFactoryBase::GetRegisteredFactories()
{
// static SingletonIndex * singletonIndex = SingletonIndex::GetInstance();
// Unused(singletonIndex);
// [[maybe_unused]] static SingletonIndex * singletonIndex = SingletonIndex::GetInstance();
ObjectFactoryBase::Initialize();
return m_PimplGlobals->m_RegisteredFactories;
}
Expand Down

0 comments on commit a28242a

Please sign in to comment.