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

Clean up small number of sonarcloud bugs / warnings #560

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions IlmBase/Half/halfFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ class halfFunction
T nanValue = 0);

#ifndef ILMBASE_HAVE_LARGE_STACK
~halfFunction () { delete [] _lut; }
~halfFunction () { delete [] _lut; }
halfFunction (const halfFunction &) = delete;
halfFunction& operator= (const halfFunction &) = delete;
halfFunction (halfFunction &&) = delete;
halfFunction& operator= (halfFunction &&) = delete;
#endif

//-----------
// Evaluation
//-----------
Expand Down
4 changes: 2 additions & 2 deletions IlmBase/HalfTest/testBitPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ testBitPatterns()
testBits (HALF_MIN + HALF_MIN * 0.5001f,
"0 00000 0000000010",
"0 01101000 00000000000000000000000");
testBits (HALF_MIN - HALF_MIN,
testBits (HALF_MIN - HALF_MIN, // NOSONAR - suppress SonarCloud bug report.
"0 00000 0000000000",
"0 00000000 00000000000000000000000");
testBits (HALF_MIN - HALF_MIN * 0.5f,
Expand Down Expand Up @@ -381,7 +381,7 @@ testBitPatterns()
testBits (-(HALF_MIN + HALF_MIN * 0.5001f),
"1 00000 0000000010",
"1 01101000 00000000000000000000000");
testBits (-(HALF_MIN - HALF_MIN),
testBits (-(HALF_MIN - HALF_MIN), // NOSONAR - suppress SonarCloud bug report.
"X 00000 0000000000",
"X 00000000 00000000000000000000000");
testBits (-(HALF_MIN - HALF_MIN * 0.5f),
Expand Down
4 changes: 4 additions & 0 deletions IlmBase/IexMath/IexMathFloatExc.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class MathExcOn

IEXMATH_EXPORT MathExcOn (int when);
IEXMATH_EXPORT ~MathExcOn ();
MathExcOn (const MathExcOn&) = delete;
MathExcOn& operator= (const MathExcOn&) = delete;
MathExcOn (MathExcOn&&) = delete;
MathExcOn& operator= (MathExcOn&&) = delete;

// It is possible for functions to set the exception registers
// yet not trigger a SIGFPE. Specifically, the implementation
Expand Down
6 changes: 5 additions & 1 deletion IlmBase/IlmThread/IlmThreadMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ class ILMTHREAD_EXPORT Lock
if (_locked)
_mutex.unlock();
}

Lock (const Lock&) = delete;
Lock &operator= (const Lock&) = delete;
Lock (Lock&&) = delete;
Lock& operator= (Lock&&) = delete;

void acquire ()
{
_mutex.lock();
Expand Down
5 changes: 4 additions & 1 deletion IlmBase/IlmThread/IlmThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ struct ThreadPool::Data

Data ();
~Data();
Data (const Data&) = delete;
Data &operator= (const Data&) = delete;

struct SafeProvider
{
Expand Down Expand Up @@ -653,11 +655,12 @@ ThreadPool::Data::setProvider (ThreadPoolProvider *p)
}
#else
ThreadPoolProvider *old = provider.load( std::memory_order_relaxed );
// work around older gcc bug just in case
do
{
if ( ! provider.compare_exchange_weak( old, p, std::memory_order_release, std::memory_order_relaxed ) )
continue;
} while ( false );
} while (false); // NOSONAR - suppress SonarCloud bug report.

// wait for any other users to finish prior to deleting, given
// that these are just mostly to query the thread count or push a
Expand Down
9 changes: 8 additions & 1 deletion IlmBase/IlmThread/IlmThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ class ILMTHREAD_EXPORT ThreadPool
//-----------------------------------------------------------

virtual ~ThreadPool ();

ThreadPool (const ThreadPool&) = delete;
ThreadPool& operator= (const ThreadPool&) = delete;
ThreadPool (ThreadPool&&) = delete;
ThreadPool& operator= (ThreadPool&&) = delete;

//--------------------------------------------------------
// Query and set the number of worker threads in the pool.
Expand Down Expand Up @@ -193,6 +196,10 @@ class ILMTHREAD_EXPORT Task

Task (TaskGroup* g);
virtual ~Task ();
Task (const Task&) = delete;
Task &operator= (const Task&) = delete;
Task (Task&&) = delete;
Task& operator= (Task&&) = delete;

virtual void execute () = 0;
TaskGroup * group();
Expand Down
4 changes: 2 additions & 2 deletions IlmBase/Imath/ImathColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Color3: public Vec3 <T>
Color3 (); // no initialization
explicit Color3 (T a); // (a a a)
Color3 (T a, T b, T c); // (a b c)

~Color3 () = default;

//---------------------------------
// Copy constructors and assignment
Expand Down Expand Up @@ -139,7 +139,7 @@ template <class T> class Color4
Color4 (); // no initialization
explicit Color4 (T a); // (a a a a)
Color4 (T a, T b, T c, T d); // (a b c d)

~Color4 () = default;

//---------------------------------
// Copy constructors and assignment
Expand Down
3 changes: 2 additions & 1 deletion IlmBase/ImathTest/testColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ testColor ()
assert ( in3 == out3 );

IMATH_INTERNAL_NAMESPACE::C4c testConstructor1;
IMATH_INTERNAL_NAMESPACE::C4c testConstructor2( testConstructor1 );
IMATH_INTERNAL_NAMESPACE::C4c testConstructor1i ( 0.f );
IMATH_INTERNAL_NAMESPACE::C4c testConstructor2( testConstructor1i );

testConstructor1 = testConstructor2; // use these so the compiler doesn't emit a warning

Expand Down