Commit ed6e1ba6 authored by Ben Hymers's avatar Ben Hymers
Browse files

Added OIS_UNUSED to silence unused variable warnings

Also added some other helper macros:
* OIS_INLINE_PRAGMA
* OIS_MACRO_BEGIN
* OIS_MACRO_END
parent 01314637
...@@ -148,13 +148,13 @@ namespace OIS ...@@ -148,13 +148,13 @@ namespace OIS
//-- Not so common control events, so are not required --// //-- Not so common control events, so are not required --//
//! Joystick Event, and sliderID //! Joystick Event, and sliderID
virtual bool sliderMoved( const JoyStickEvent &, int index) {return true;} virtual bool sliderMoved( const JoyStickEvent &arg, int index) { OIS_UNUSED(arg); OIS_UNUSED(index); return true; }
//! Joystick Event, and povID //! Joystick Event, and povID
virtual bool povMoved( const JoyStickEvent &arg, int index) {return true;} virtual bool povMoved( const JoyStickEvent &arg, int index) { OIS_UNUSED(arg); OIS_UNUSED(index); return true; }
//! Joystick Event, and Vector3ID //! Joystick Event, and Vector3ID
virtual bool vector3Moved( const JoyStickEvent &arg, int index) {return true;} virtual bool vector3Moved( const JoyStickEvent &arg, int index) { OIS_UNUSED(arg); OIS_UNUSED(index); return true; }
}; };
/** /**
......
...@@ -99,6 +99,26 @@ restrictions: ...@@ -99,6 +99,26 @@ restrictions:
# define OIS_ARCH_32 # define OIS_ARCH_32
#endif #endif
//-------------- Various helper preprocessor definitions ---------------------//
#ifdef OIS_MSVC_COMPILER
# define OIS_INLINE_PRAGMA(x) __pragma(x) // x is intentionally not wrapped; __pragma rejects expressions beginning with '('.
#else
# define OIS_INLINE_PRAGMA(x)
#endif
#define OIS_MACRO_BEGIN do {
#define OIS_MACRO_END \
} OIS_INLINE_PRAGMA(warning(push)) OIS_INLINE_PRAGMA(warning(disable:4127)) while (0) OIS_INLINE_PRAGMA(warning(pop))
// This creative trickery taken from this StackOverflow answer:
// http://stackoverflow.com/questions/4030959/will-a-variablename-c-statement-be-a-no-op-at-all-times/4030983#4030983
#define OIS_UNUSED(x)\
OIS_MACRO_BEGIN\
((void)(true ? 0 : ((x), void(), 0)));\
OIS_MACRO_END
//-------------- Common Classes, Enums, and Typdef's -------------------------// //-------------- Common Classes, Enums, and Typdef's -------------------------//
#define OIS_VERSION_MAJOR 1 #define OIS_VERSION_MAJOR 1
#define OIS_VERSION_MINOR 4 #define OIS_VERSION_MINOR 4
......
...@@ -60,7 +60,7 @@ namespace OIS ...@@ -60,7 +60,7 @@ namespace OIS
virtual void capture(); virtual void capture();
/** @copydoc Object::queryInterface */ /** @copydoc Object::queryInterface */
virtual Interface* queryInterface(Interface::IType type) {return 0;} virtual Interface* queryInterface(Interface::IType type) { OIS_UNUSED(type); return 0; }
/** @copydoc Object::_initialize */ /** @copydoc Object::_initialize */
virtual void _initialize(); virtual void _initialize();
......
...@@ -41,7 +41,7 @@ namespace OIS ...@@ -41,7 +41,7 @@ namespace OIS
virtual void capture(); virtual void capture();
/** @copydoc Object::queryInterface */ /** @copydoc Object::queryInterface */
virtual Interface* queryInterface(Interface::IType type) {return 0;} virtual Interface* queryInterface(Interface::IType type) { OIS_UNUSED(type); return 0;}
/** @copydoc Object::_initialize */ /** @copydoc Object::_initialize */
virtual void _initialize(); virtual void _initialize();
......
...@@ -266,6 +266,8 @@ void InputManager::removeFactoryCreator( FactoryCreator* factory ) ...@@ -266,6 +266,8 @@ void InputManager::removeFactoryCreator( FactoryCreator* factory )
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
void InputManager::enableAddOnFactory(AddOnFactories factory) void InputManager::enableAddOnFactory(AddOnFactories factory)
{ {
OIS_UNUSED(factory);
#if defined OIS_LIRC_SUPPORT #if defined OIS_LIRC_SUPPORT
if( factory == AddOn_LIRC || factory == AddOn_All ) if( factory == AddOn_LIRC || factory == AddOn_All )
{ {
......
...@@ -230,6 +230,8 @@ bool Win32InputManager::vendorExist(Type iType, const std::string & vendor) ...@@ -230,6 +230,8 @@ bool Win32InputManager::vendorExist(Type iType, const std::string & vendor)
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
Object* Win32InputManager::createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor) Object* Win32InputManager::createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor)
{ {
OIS_UNUSED(creator);
Object *obj = 0; Object *obj = 0;
switch(iType) switch(iType)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment