Skip to content

Commit

Permalink
No CC_UNUSED_PARAM (cocos2d#16812)
Browse files Browse the repository at this point in the history
* Added -Wno-unused-parameter and removed all uses of the CC_UNUSED_PARAM macro

* Commented unused parameter names in .cpp files which previously used CC_UNUSED_PARAM

* Reverted -Wno-unused-param flag.
Moved deprecated touch methods definitions to .cpp file.
Commented more unused parameter names.

* Fixed some errors and warnings caused by the previous commit.

* Commented remaining unused parameter names in .cpp files.

* Fixed unused parameter warnings in headers.

* Fixed some more unused parameter warnings.

* Fixed some more unused parameters warnings.

* Fixed mistake in previous commit, missing ComAudioReader:: in method. Other warnings.

* Fixed build errors.

* Added missing file to CMakeLists
  • Loading branch information
filipe-lemos authored and minggo committed Nov 16, 2016
1 parent ae48e0b commit 663bb4d
Show file tree
Hide file tree
Showing 233 changed files with 977 additions and 891 deletions.
10 changes: 3 additions & 7 deletions cocos/2d/CCAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ bool Action::isDone() const
return true;
}

void Action::step(float dt)
void Action::step(float /*dt*/)
{
CC_UNUSED_PARAM(dt);
CCLOG("[Action step]. override me");
}

void Action::update(float time)
void Action::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
CCLOG("[Action update]. override me");
}

Expand Down Expand Up @@ -283,10 +281,8 @@ bool Follow::initWithTarget(Node *followedNode, const Rect& rect /*= Rect::ZERO*
return initWithTargetAndOffset(followedNode, 0.0, 0.0,rect);

}
void Follow::step(float dt)
void Follow::step(float /*dt*/)
{
CC_UNUSED_PARAM(dt);

if(_boundarySet)
{
// whole map fits inside a single screen, no need to modify the position - unless map boundaries are increased
Expand Down
6 changes: 2 additions & 4 deletions cocos/2d/CCActionGrid3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,8 @@ void Lens3D::setPosition(const Vec2& pos)
}
}

void Lens3D::update(float time)
void Lens3D::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
if (_dirty)
{
int i, j;
Expand Down Expand Up @@ -498,9 +497,8 @@ Shaky3D* Shaky3D::clone() const
return a;
}

void Shaky3D::update(float time)
void Shaky3D::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
int i, j;

for (i = 0; i < (_gridSize.width+1); ++i)
Expand Down
30 changes: 10 additions & 20 deletions cocos/2d/CCActionInstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ bool ActionInstant::isDone() const
return true;
}

void ActionInstant::step(float dt)
void ActionInstant::step(float /*dt*/)
{
CC_UNUSED_PARAM(dt);
float updateDt = 1;
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
Expand All @@ -59,9 +58,8 @@ void ActionInstant::step(float dt)
update(updateDt);
}

void ActionInstant::update(float time)
void ActionInstant::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
// nothing
}

Expand All @@ -81,9 +79,8 @@ Show* Show::create()
return ret;
}

void Show::update(float time)
void Show::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
_target->setVisible(true);
}

Expand Down Expand Up @@ -113,9 +110,8 @@ Hide * Hide::create()
return ret;
}

void Hide::update(float time)
void Hide::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
_target->setVisible(false);
}

Expand Down Expand Up @@ -145,9 +141,8 @@ ToggleVisibility * ToggleVisibility::create()
return ret;
}

void ToggleVisibility::update(float time)
void ToggleVisibility::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
_target->setVisible(!_target->isVisible());
}

Expand Down Expand Up @@ -183,9 +178,8 @@ bool RemoveSelf::init(bool isNeedCleanUp)
return true;
}

void RemoveSelf::update(float time)
void RemoveSelf::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
_target->removeFromParentAndCleanup(_isNeedCleanUp);
}

Expand Down Expand Up @@ -224,9 +218,8 @@ bool FlipX::initWithFlipX(bool x)
return true;
}

void FlipX::update(float time)
void FlipX::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
static_cast<Sprite*>(_target)->setFlippedX(_flipX);
}

Expand Down Expand Up @@ -264,9 +257,8 @@ bool FlipY::initWithFlipY(bool y)
return true;
}

void FlipY::update(float time)
void FlipY::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
static_cast<Sprite*>(_target)->setFlippedY(_flipY);
}

Expand Down Expand Up @@ -317,9 +309,8 @@ Place * Place::reverse() const
return this->clone();
}

void Place::update(float time)
void Place::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
_target->setPosition(_position);
}

Expand Down Expand Up @@ -407,9 +398,8 @@ CallFunc * CallFunc::reverse() const
return this->clone();
}

void CallFunc::update(float time)
void CallFunc::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
this->execute();
}

Expand Down
12 changes: 4 additions & 8 deletions cocos/2d/CCActionInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ ExtraAction* ExtraAction::reverse() const
return ExtraAction::create();
}

void ExtraAction::update(float time)
void ExtraAction::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
}

void ExtraAction::step(float dt)
void ExtraAction::step(float /*dt*/)
{
CC_UNUSED_PARAM(dt);
}

//
Expand Down Expand Up @@ -144,9 +142,8 @@ void ActionInterval::step(float dt)
this->update(updateDt);
}

void ActionInterval::setAmplitudeRate(float amp)
void ActionInterval::setAmplitudeRate(float /*amp*/)
{
CC_UNUSED_PARAM(amp);
// Abstract class needs implementation
CCASSERT(0, "Subclass should implement this method!");
}
Expand Down Expand Up @@ -2420,9 +2417,8 @@ DelayTime* DelayTime::clone() const
return DelayTime::create(_duration);
}

void DelayTime::update(float time)
void DelayTime::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
return;
}

Expand Down
6 changes: 2 additions & 4 deletions cocos/2d/CCActionTiledGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ ShakyTiles3D* ShakyTiles3D::clone() const
return ShakyTiles3D::create(_duration, _gridSize, _randrange, _shakeZ);
}

void ShakyTiles3D::update(float time)
void ShakyTiles3D::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
int i, j;

for (i = 0; i < _gridSize.width; ++i)
Expand Down Expand Up @@ -145,9 +144,8 @@ ShatteredTiles3D* ShatteredTiles3D::clone() const
return ShatteredTiles3D::create(_duration, _gridSize, _randrange, _shatterZ);
}

void ShatteredTiles3D::update(float time)
void ShatteredTiles3D::update(float /*time*/)
{
CC_UNUSED_PARAM(time);
int i, j;

if (_once == false)
Expand Down
8 changes: 2 additions & 6 deletions cocos/2d/CCGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ void Grabber::grab(Texture2D *texture)
glBindFramebuffer(GL_FRAMEBUFFER, _oldFBO);
}

void Grabber::beforeRender(Texture2D *texture)
void Grabber::beforeRender(Texture2D* /*texture*/)
{
CC_UNUSED_PARAM(texture);

glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_oldFBO);
glBindFramebuffer(GL_FRAMEBUFFER, _FBO);

Expand All @@ -81,10 +79,8 @@ void Grabber::beforeRender(Texture2D *texture)
// glColorMask(true, true, true, false); // #631
}

void Grabber::afterRender(cocos2d::Texture2D *texture)
void Grabber::afterRender(cocos2d::Texture2D* /*texture*/)
{
CC_UNUSED_PARAM(texture);

glBindFramebuffer(GL_FRAMEBUFFER, _oldFBO);
// glColorMask(true, true, true, true); // #631

Expand Down
Loading

0 comments on commit 663bb4d

Please sign in to comment.