Skip to content
Snippets Groups Projects
Commit d0796500 authored by Bienchen's avatar Bienchen
Browse files

SCHWED-4612: Get rid of '-Wmaybe-uninitialized' from Vec3

parent 543a4e2c
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,23 @@ public:
//! explicit initialization with an array of floats
explicit Vec3(const float v[3]): x(v[0]), y(v[1]), z(v[2]) { }
/* The "=" operator for Vec3 gives the "maybe-uninitialize" warning in
combination with GenericPropValue with GCC when optimisation is turned on.
GenericPropValue is implemented via boost::variant which may confuse GCC
tracking variables through the compilation process. As boost::variant is
able to search for a "=" operator of different type if no direct match is
provided, maybe GCC mixes the Real and Vec3 operators where Real used for
Vec3 would indeed lack the y and z component. According to the GCC manual,
the "maybe-uninitialize" warnings are prone to produce false positives.
There is actually an initiative to get rid of them.
We ignore them for this particular case by saving the current diagnostic
settings (push), disabling the warning in the diagnostics
(ignored "-Wmaybe-uninitialized") and afterwards restoring the old
diagnostics context (pop).
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
//! assignement op
Vec3& operator=(const Vec3& v)
{
......@@ -81,7 +98,8 @@ public:
z=v.z;
return *this;
}
#pragma GCC diagnostic pop
//! comparable
bool operator==(const Vec3& rhs) const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment