From a89b9f6158d5bfbad0e9ff0f7822a1f3a5d1893f Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Mon, 9 Jan 2012 20:19:26 +0100 Subject: [PATCH] #581, invalid gcc pragma syntax Thanks to Olaf Flebbe. --- simgear/math/SGSphere.hxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/simgear/math/SGSphere.hxx b/simgear/math/SGSphere.hxx index 9806e9e8..da0c641a 100644 --- a/simgear/math/SGSphere.hxx +++ b/simgear/math/SGSphere.hxx @@ -18,13 +18,17 @@ #ifndef SGSphere_H #define SGSphere_H -#ifndef _MSC_VER -# pragma GCC diagnostic ignored "-Wuninitialized" SGSphere(); -#endif template class SGSphere { public: + +#ifdef __GNUC__ +// Avoid "_center not initialized" warnings. +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wuninitialized" +#endif + SGSphere() : /* * Do not initialize _center to save unneeded initialization time. @@ -43,6 +47,11 @@ public: _radius(sphere.getRadius()) { } +#ifdef __GNUC__ + // Restore warning settings. +# pragma GCC diagnostic pop +#endif + const SGVec3& getCenter() const { return _center; } void setCenter(const SGVec3& center)