Reverted the usage of OSG_UNUSED and OT_UNUSED as in hindsight these should never have been merged. Adding code to quieten

inappropriate warnings is a bad programming practice and does not desrve a place in the OSG code base.
This commit is contained in:
Robert Osfield 2013-07-01 08:21:13 +00:00
parent e876e0bad3
commit a64b412885
11 changed files with 15 additions and 64 deletions

View File

@ -39,10 +39,6 @@
#endif #endif
#endif #endif
#ifndef OT_UNUSED
#define OT_UNUSED(var) (void) var
#endif
#endif #endif

View File

@ -60,12 +60,6 @@
#endif #endif
#endif #endif
#ifndef OSG_UNUSED
#define OSG_UNUSED(var) (void) var
#endif
/** /**
\namespace osg \namespace osg

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group /* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -238,8 +238,7 @@ private:
} }
fflush(stdout); fflush(stdout);
#else // ] ALLOW_PRIORITY_SCHEDULING
OT_UNUSED(thread);
#endif // ] ALLOW_PRIORITY_SCHEDULING #endif // ] ALLOW_PRIORITY_SCHEDULING
} }
@ -347,8 +346,6 @@ private:
} }
#else // ] ALLOW_PRIORITY_SCHEDULING
OT_UNUSED(thread);
#endif // ] ALLOW_PRIORITY_SCHEDULING #endif // ] ALLOW_PRIORITY_SCHEDULING
return status; return status;
@ -369,7 +366,6 @@ int Thread::SetConcurrency(int concurrencyLevel)
#if defined (HAVE_PTHREAD_SETCONCURRENCY) #if defined (HAVE_PTHREAD_SETCONCURRENCY)
return pthread_setconcurrency(concurrencyLevel); return pthread_setconcurrency(concurrencyLevel);
#else #else
OT_UNUSED(concurrencyLevel);
return -1; return -1;
#endif #endif
@ -440,7 +436,7 @@ Thread::~Thread()
} }
delete pd; delete pd;
_prvData = 0; _prvData = 0;
} }
@ -554,7 +550,7 @@ int Thread::setProcessorAffinity(unsigned int cpunum)
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData); PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
pd->cpunum = cpunum; pd->cpunum = cpunum;
if (pd->cpunum<0) return -1; if (pd->cpunum<0) return -1;
#ifdef __sgi #ifdef __sgi
int status; int status;
@ -696,7 +692,7 @@ int Thread::start() {
// //
int Thread::startThread() int Thread::startThread()
{ {
if (_prvData) return start(); if (_prvData) return start();
else return 0; else return 0;
} }
@ -843,7 +839,6 @@ int Thread::setSchedulePriority(ThreadPriority priority) {
return 0; return 0;
#else #else
OT_UNUSED(priority);
return -1; return -1;
#endif #endif
@ -883,7 +878,6 @@ int Thread::setSchedulePolicy(ThreadPolicy policy)
else else
return 0; return 0;
#else #else
OT_UNUSED(policy);
return -1; return -1;
#endif #endif
@ -1015,7 +1009,7 @@ int OpenThreads::GetNumberOfProcessors()
uint64_t num_cpus = 0; uint64_t num_cpus = 0;
size_t num_cpus_length = sizeof(num_cpus); size_t num_cpus_length = sizeof(num_cpus);
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
sysctlbyname("hw.ncpu", &num_cpus, &num_cpus_length, NULL, 0); sysctlbyname("hw.ncpu", &num_cpus, &num_cpus_length, NULL, 0);
#else #else
sysctlbyname("hw.activecpu", &num_cpus, &num_cpus_length, NULL, 0); sysctlbyname("hw.activecpu", &num_cpus, &num_cpus_length, NULL, 0);
#endif #endif
@ -1030,7 +1024,7 @@ int OpenThreads::SetProcessorAffinityOfCurrentThread(unsigned int cpunum)
Thread::Init(); Thread::Init();
Thread* thread = Thread::CurrentThread(); Thread* thread = Thread::CurrentThread();
if (thread) if (thread)
{ {
return thread->setProcessorAffinity(cpunum); return thread->setProcessorAffinity(cpunum);
} }
@ -1052,6 +1046,6 @@ int OpenThreads::SetProcessorAffinityOfCurrentThread(unsigned int cpunum)
#endif #endif
#endif #endif
} }
return -1; return -1;
} }

View File

@ -110,8 +110,6 @@ void DrawArrayLengths::draw(State& state, bool) const
} }
if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN; if (mode==GL_POLYGON) mode = GL_TRIANGLE_FAN;
if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP; if (mode==GL_QUAD_STRIP) mode = GL_TRIANGLE_STRIP;
#else
OSG_UNUSED(state);
#endif #endif
GLint first = _first; GLint first = _first;

View File

@ -110,8 +110,6 @@ void Referenced::setThreadSafeReferenceCounting(bool enableThreadSafeReferenceCo
{ {
#if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) #if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS)
s_useThreadSafeReferenceCounting = enableThreadSafeReferenceCounting; s_useThreadSafeReferenceCounting = enableThreadSafeReferenceCounting;
#else
OSG_UNUSED(enableThreadSafeReferenceCounting);
#endif #endif
} }
@ -184,12 +182,8 @@ Referenced::Referenced(bool threadSafeRefUnref):
#if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) #if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS)
#ifndef ENFORCE_THREADSAFE #ifndef ENFORCE_THREADSAFE
if (threadSafeRefUnref) if (threadSafeRefUnref)
#else
OSG_UNUSED(threadSafeRefUnref);
#endif #endif
_refMutex = new OpenThreads::Mutex; _refMutex = new OpenThreads::Mutex;
#else
OSG_UNUSED(threadSafeRefUnref);
#endif #endif
#ifdef DEBUG_OBJECT_ALLOCATION_DESTRUCTION #ifdef DEBUG_OBJECT_ALLOCATION_DESTRUCTION
@ -353,8 +347,6 @@ void Referenced::setThreadSafeRefUnref(bool threadSafe)
delete tmpMutexPtr; delete tmpMutexPtr;
} }
} }
#else
OSG_UNUSED(threadSafe);
#endif #endif
} }

View File

@ -65,8 +65,6 @@ std::string convertUTF16toUTF8(const wchar_t* source, unsigned sourceLength)
#else #else
//TODO: Implement for other platforms //TODO: Implement for other platforms
OSG_WARN << "ConvertUTF16toUTF8 not implemented." << std::endl; OSG_WARN << "ConvertUTF16toUTF8 not implemented." << std::endl;
OSG_UNUSED(source);
OSG_UNUSED(sourceLength);
return std::string(); return std::string();
#endif #endif
} }
@ -99,8 +97,6 @@ std::wstring convertUTF8toUTF16(const char* source, unsigned sourceLength)
#else #else
//TODO: Implement for other platforms //TODO: Implement for other platforms
OSG_WARN << "ConvertUTF8toUTF16 not implemented." << std::endl; OSG_WARN << "ConvertUTF8toUTF16 not implemented." << std::endl;
OSG_UNUSED(source);
OSG_UNUSED(sourceLength);
return std::wstring(); return std::wstring();
#endif #endif
} }
@ -130,7 +126,6 @@ std::string convertStringFromCurrentCodePageToUTF8(const char* source, unsigned
return convertUTF16toUTF8(sUTF16); return convertUTF16toUTF8(sUTF16);
#else #else
OSG_UNUSED(sourceLength);
return source; return source;
#endif #endif
} }
@ -163,7 +158,6 @@ std::string convertStringFromUTF8toCurrentCodePage(const char* source, unsigned
return sDest; return sDest;
#else #else
OSG_UNUSED(sourceLength);
return source; return source;
#endif #endif
} }

View File

@ -1162,9 +1162,7 @@ bool ConvexPolyhedron::checkCoherency
dumpGeometry( ); dumpGeometry( );
#endif #endif
#else
OSG_UNUSED(checkForNonConvexPolys);
OSG_UNUSED(errorPrefix);
#endif // CONVEX_POLYHEDRON_CHECK_COHERENCY #endif // CONVEX_POLYHEDRON_CHECK_COHERENCY
return result && convex; return result && convex;
} }

View File

@ -154,9 +154,6 @@ bool DebugShadowMap::ViewData::DebugBoundingBox
<< std::endl; << std::endl;
bb_prev = bb; bb_prev = bb;
#else
OSG_UNUSED(bb);
OSG_UNUSED(name);
#endif #endif
return result; return result;
} }
@ -195,9 +192,6 @@ bool DebugShadowMap::ViewData::DebugPolytope
} }
p_prev = p; p_prev = p;
#else
OSG_UNUSED(p);
OSG_UNUSED(name);
#endif #endif
return result; return result;
} }
@ -221,9 +215,6 @@ bool DebugShadowMap::ViewData::DebugMatrix
<<"[ " << m(3,0) << " " << m(3,1) << " " << m(3,2) << " " << m(3,3) << " ] " << std::endl; <<"[ " << m(3,0) << " " << m(3,1) << " " << m(3,2) << " " << m(3,3) << " ] " << std::endl;
m_prev = m; m_prev = m;
#else
OSG_UNUSED(m);
OSG_UNUSED(name);
#endif #endif
return result; return result;
} }

View File

@ -94,8 +94,6 @@ void Input::_calculateSize(const XYCoord& size) {
if(width > getWidth()) setWidth(osg::round(width)); if(width > getWidth()) setWidth(osg::round(width));
if(height > getHeight()) setHeight(osg::round(height)); if(height > getHeight()) setHeight(osg::round(height));
#else
OSG_UNUSED(size);
#endif #endif
} }
@ -283,11 +281,11 @@ void Input::positioned()
} }
} }
bool Input::keyUp(int /*key*/, int /*mask*/, const WindowManager*) { bool Input::keyUp(int key, int mask, const WindowManager*) {
return false; return false;
} }
bool Input::mouseDrag (double x, double /*y*/, const WindowManager*) bool Input::mouseDrag (double x, double y, const WindowManager*)
{ {
_mouseClickX += x; _mouseClickX += x;
x = _mouseClickX; x = _mouseClickX;
@ -308,7 +306,7 @@ bool Input::mouseDrag (double x, double /*y*/, const WindowManager*)
return true; return true;
} }
bool Input::mousePush (double x, double /*y*/, const WindowManager* /*wm*/) bool Input::mousePush (double x, double y, const WindowManager* wm)
{ {
double offset = getOrigin().x(); double offset = getOrigin().x();
Window* window = getParent(); Window* window = getParent();

View File

@ -142,7 +142,6 @@ bool LuaEngine::eval(const std::string& code) {
return true; return true;
#else #else
OSG_UNUSED(code);
return noLuaFail("Can't evaluate code in LuaEngine"); return noLuaFail("Can't evaluate code in LuaEngine");
#endif #endif
} }
@ -164,7 +163,6 @@ bool LuaEngine::runFile(const std::string& filePath) {
return true; return true;
#else #else
OSG_UNUSED(filePath);
return noLuaFail("Can't run file in LuaEngine"); return noLuaFail("Can't run file in LuaEngine");
#endif #endif
} }

View File

@ -156,7 +156,6 @@ bool PythonEngine::eval(const std::string& code) {
return true; return true;
#else #else
OSG_UNUSED(code);
return noPythonFail("Can't evaluate code in PythonEngine"); return noPythonFail("Can't evaluate code in PythonEngine");
#endif #endif
} }
@ -208,7 +207,6 @@ bool PythonEngine::runFile(const std::string& filePath) {
return true; return true;
#else #else
OSG_UNUSED(filePath);
return noPythonFail("Can't evaluate code in PythonEngine"); return noPythonFail("Can't evaluate code in PythonEngine");
#endif #endif
} }