I use -Wall during day-to-day coding.
So, I would like to submit warning fixes for OIS.
The warnings that I get under Linux GCC are of this type:
/usr/local/include/OIS/OISMouse.h:57: warning: ignoring #pragma warning
/usr/local/include/OIS/OISMouse.h:58: warning: ignoring #pragma warning
/usr/local/include/OIS/OISMouse.h:60: warning: ignoring #pragma warning
/usr/local/include/OIS/OISEffect.h:174: warning: ignoring #pragma warning
.h:175: warning: ignoring #pragma warning
/usr/local/include/OIS/OISEffect.h:177: warning: ignoring #pragma warning
/usr/local/include/OIS/OISEffect.h:221: warning: `OIS::PeriodicEffect::period' will be initialized after
/usr/local/include/OIS/OISEffect.h:218: warning: `short unsigned int OIS::PeriodicEffect::magnitude'
/usr/local/include/OIS/OISEffect.h:216: warning: when initialized here
/usr/local/include/OIS/OISEffect.h:239: warning: `OIS::ConditionalEffect::leftSaturation' will be initialized after
/usr/local/include/OIS/OISEffect.h:235: warning: `short int OIS::ConditionalEffect::rightCoeff'
/usr/local/include/OIS/OISEffect.h:233: warning: when initialized here
/usr/local/include/OIS/OISException.h:63: warning: `OIS::Exception::eText' will be initialized after
/usr/local/include/OIS/OISException.h:59: warning: `const int OIS::Exception::eLine'
/usr/local/include/OIS/OISException.h:54: warning: when initialized here
They come from this code: struct _OISExport PeriodicEffect : public ForceEffect
{
//problem line//PeriodicEffect() : period(0), magnitude(0), offset(0), phase(0) {}
// now my fix
PeriodicEffect() : magnitude(0), offset(0), phase(0), period(0) {}
unsigned short magnitude; //0 to 10,0000
signed short offset;
unsigned short phase; //Position at which playback begins 0 to 35,999
unsigned int period; //Period of effect (microseconds)
struct Envelope envelope; //Optional Envelope
}; Commented out constructor is the original line, the next one is mine to resolve those warning.
Warnings are clearly not critical in any way that I know of, but this makes by programming days easier, and it is almost nothing to fix this.
Here are other parts: struct _OISExport ConditionalEffect : public ForceEffect
{
//ConditionalEffect() : rightSaturation(0), leftSaturation(0),
// rightCoeff(0), leftCoeff(0), deadband(0), center(0) {}
ConditionalEffect() : rightCoeff(0),leftCoeff(0),rightSaturation(0),
leftSaturation(0), deadband(0), center(0) {}
signed short rightCoeff; //-10k to +10k (Positive Coeff)
signed short leftCoeff; //-10k to +10k (Negative Coeff)
and class _OISExport Exception
{
//! Hidden default
Exception() : eType(E_General), eLine(0), eFile(0) {}
public:
//! Creates exception object
Exception( OIS_ERROR err, const char* str, int line, const char *file )
// and now the following is fixed off warnings
: eType(err), eLine(line), eFile(file), eText(str) {}
The only other thing is left are #pragma warning which gcc does not like. It states during compilations that those lines are ignored. For my Linux deps i simply commented those lines out, but a better solution would be to check if it's Linux or Windows platform and turn those lines off with a define check.