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
#ifndef OT_UNUSED
#define OT_UNUSED(var) (void) var
#endif
#endif

View File

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

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
*
* 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
* 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
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* 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.
*/
@ -238,8 +238,7 @@ private:
}
fflush(stdout);
#else // ] ALLOW_PRIORITY_SCHEDULING
OT_UNUSED(thread);
#endif // ] ALLOW_PRIORITY_SCHEDULING
}
@ -347,8 +346,6 @@ private:
}
#else // ] ALLOW_PRIORITY_SCHEDULING
OT_UNUSED(thread);
#endif // ] ALLOW_PRIORITY_SCHEDULING
return status;
@ -369,7 +366,6 @@ int Thread::SetConcurrency(int concurrencyLevel)
#if defined (HAVE_PTHREAD_SETCONCURRENCY)
return pthread_setconcurrency(concurrencyLevel);
#else
OT_UNUSED(concurrencyLevel);
return -1;
#endif
@ -440,7 +436,7 @@ Thread::~Thread()
}
delete pd;
_prvData = 0;
}
@ -554,7 +550,7 @@ int Thread::setProcessorAffinity(unsigned int cpunum)
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
pd->cpunum = cpunum;
if (pd->cpunum<0) return -1;
#ifdef __sgi
int status;
@ -696,7 +692,7 @@ int Thread::start() {
//
int Thread::startThread()
{
if (_prvData) return start();
if (_prvData) return start();
else return 0;
}
@ -843,7 +839,6 @@ int Thread::setSchedulePriority(ThreadPriority priority) {
return 0;
#else
OT_UNUSED(priority);
return -1;
#endif
@ -883,7 +878,6 @@ int Thread::setSchedulePolicy(ThreadPolicy policy)
else
return 0;
#else
OT_UNUSED(policy);
return -1;
#endif
@ -1015,7 +1009,7 @@ int OpenThreads::GetNumberOfProcessors()
uint64_t num_cpus = 0;
size_t num_cpus_length = sizeof(num_cpus);
#if defined(__FreeBSD__)
sysctlbyname("hw.ncpu", &num_cpus, &num_cpus_length, NULL, 0);
sysctlbyname("hw.ncpu", &num_cpus, &num_cpus_length, NULL, 0);
#else
sysctlbyname("hw.activecpu", &num_cpus, &num_cpus_length, NULL, 0);
#endif
@ -1030,7 +1024,7 @@ int OpenThreads::SetProcessorAffinityOfCurrentThread(unsigned int cpunum)
Thread::Init();
Thread* thread = Thread::CurrentThread();
if (thread)
if (thread)
{
return thread->setProcessorAffinity(cpunum);
}
@ -1052,6 +1046,6 @@ int OpenThreads::SetProcessorAffinityOfCurrentThread(unsigned int cpunum)
#endif
#endif
}
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_QUAD_STRIP) mode = GL_TRIANGLE_STRIP;
#else
OSG_UNUSED(state);
#endif
GLint first = _first;

View File

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

View File

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

View File

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

View File

@ -154,9 +154,6 @@ bool DebugShadowMap::ViewData::DebugBoundingBox
<< std::endl;
bb_prev = bb;
#else
OSG_UNUSED(bb);
OSG_UNUSED(name);
#endif
return result;
}
@ -195,9 +192,6 @@ bool DebugShadowMap::ViewData::DebugPolytope
}
p_prev = p;
#else
OSG_UNUSED(p);
OSG_UNUSED(name);
#endif
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_prev = m;
#else
OSG_UNUSED(m);
OSG_UNUSED(name);
#endif
return result;
}

View File

@ -94,8 +94,6 @@ void Input::_calculateSize(const XYCoord& size) {
if(width > getWidth()) setWidth(osg::round(width));
if(height > getHeight()) setHeight(osg::round(height));
#else
OSG_UNUSED(size);
#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;
}
bool Input::mouseDrag (double x, double /*y*/, const WindowManager*)
bool Input::mouseDrag (double x, double y, const WindowManager*)
{
_mouseClickX += x;
x = _mouseClickX;
@ -308,7 +306,7 @@ bool Input::mouseDrag (double x, double /*y*/, const WindowManager*)
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();
Window* window = getParent();

View File

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

View File

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