Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0874818

Browse files
JohnCoconutminggo
authored andcommittedJul 16, 2019
clang tidy modernize redundant void arg (#19900)
* add new clang-tidy option above * fix warnings from performance-unnecessary-value-param Reference: https://releases.llvm.org/7.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-redundant-void-arg.html
1 parent a3911cf commit 0874818

File tree

23 files changed

+46
-45
lines changed

23 files changed

+46
-45
lines changed
 

‎.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Checks: >
2424
bugprone-forwarding-reference-overload,
2525
bugprone-inaccurate-erase,
2626
bugprone-incorrect-roundings,
27+
modernize-redundant-void-arg,
2728
2829
WarningsAsErrors: '*'
2930
HeaderFilterRegex: '/(?!external)/.*'

‎cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19069,7 +19069,7 @@ bool js_cocos2dx_FileUtils_getStringFromFile(JSContext *cx, uint32_t argc, jsval
1906919069
{
1907019070
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
1907119071
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
19072-
auto lambda = [=](std::string larg0) -> void {
19072+
auto lambda = [=](const std::string& larg0) -> void {
1907319073
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
1907419074
jsval largv[1];
1907519075
largv[0] = std_string_to_jsval(cx, larg0);

‎cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6737,7 +6737,7 @@ bool js_cocos2dx_extension_AssetsManagerEx_setVerifyCallback(JSContext *cx, uint
67376737
{
67386738
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
67396739
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
6740-
auto lambda = [=](const std::string& larg0, cocos2d::extension::ManifestAsset larg1) -> bool {
6740+
auto lambda = [=](const std::string& larg0, const cocos2d::extension::ManifestAsset& larg1) -> bool {
67416741
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
67426742
jsval largv[2];
67436743
largv[0] = std_string_to_jsval(cx, larg0);

‎tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ ActionManagerTests::ActionManagerTests()
5353
//
5454
//------------------------------------------------------------------
5555

56-
ActionManagerTest::ActionManagerTest(void)
56+
ActionManagerTest::ActionManagerTest()
5757
{
5858
}
5959

60-
ActionManagerTest::~ActionManagerTest(void)
60+
ActionManagerTest::~ActionManagerTest()
6161
{
6262
}
6363

‎tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,11 +1003,11 @@ ActionsEaseTests::ActionsEaseTests()
10031003
ADD_TEST_CASE(SpeedTest);
10041004
}
10051005

1006-
EaseSpriteDemo::EaseSpriteDemo(void)
1006+
EaseSpriteDemo::EaseSpriteDemo()
10071007
{
10081008
}
10091009

1010-
EaseSpriteDemo::~EaseSpriteDemo(void)
1010+
EaseSpriteDemo::~EaseSpriteDemo()
10111011
{
10121012
_grossini->release();
10131013
_tamara->release();

‎tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ ActionsProgressTests::ActionsProgressTests()
4545
// SpriteDemo
4646
//
4747
//------------------------------------------------------------------
48-
SpriteDemo::SpriteDemo(void)
48+
SpriteDemo::SpriteDemo()
4949
{
5050
}
5151

52-
SpriteDemo::~SpriteDemo(void)
52+
SpriteDemo::~SpriteDemo()
5353
{
5454
}
5555

‎tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void Box2dTestBed::onTouchMoved(Touch* touch, Event* event)
128128
// Box2DView
129129
//
130130
//------------------------------------------------------------------
131-
Box2DView::Box2DView(void)
131+
Box2DView::Box2DView()
132132
{
133133
}
134134

‎tests/cpp-tests/Classes/Box2DTestBed/GLES-Render.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ GLESDebugDraw::GLESDebugDraw( float32 ratio )
3838
this->initShader();
3939
}
4040

41-
void GLESDebugDraw::initShader( void )
41+
void GLESDebugDraw::initShader( )
4242
{
4343
mShaderProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
4444

‎tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void CameraRotationTest::update(float dt)
176176
// Camera3DTestDemo
177177
//
178178
//------------------------------------------------------------------
179-
Camera3DTestDemo::Camera3DTestDemo(void)
179+
Camera3DTestDemo::Camera3DTestDemo()
180180
: _cameraType(CameraType::Free)
181181
, _incRot(nullptr)
182182
, _decRot(nullptr)
@@ -187,7 +187,7 @@ Camera3DTestDemo::Camera3DTestDemo(void)
187187
, _bRotateRight(false)
188188
{
189189
}
190-
Camera3DTestDemo::~Camera3DTestDemo(void)
190+
Camera3DTestDemo::~Camera3DTestDemo()
191191
{
192192
}
193193
void Camera3DTestDemo::reachEndCallBack()
@@ -701,7 +701,7 @@ void Camera3DTestDemo::onTouchesRotateRightEnd(Touch* touch, Event* event)
701701

702702
////////////////////////////////////////////////////////////
703703
// CameraCullingDemo
704-
CameraCullingDemo::CameraCullingDemo(void)
704+
CameraCullingDemo::CameraCullingDemo()
705705
: _layer3D(nullptr)
706706
, _cameraType(CameraType::FirstPerson)
707707
, _cameraFirst(nullptr)
@@ -712,7 +712,7 @@ CameraCullingDemo::CameraCullingDemo(void)
712712
, _row(3)
713713
{
714714
}
715-
CameraCullingDemo::~CameraCullingDemo(void)
715+
CameraCullingDemo::~CameraCullingDemo()
716716
{
717717
}
718718

@@ -982,7 +982,7 @@ void CameraCullingDemo::drawCameraFrustum()
982982

983983
////////////////////////////////////////////////////////////
984984
// CameraArcBallDemo
985-
CameraArcBallDemo::CameraArcBallDemo(void)
985+
CameraArcBallDemo::CameraArcBallDemo()
986986
: CameraBaseTest()
987987
, _layer3D(nullptr)
988988
, _cameraType(CameraType::Free)
@@ -997,7 +997,7 @@ CameraArcBallDemo::CameraArcBallDemo(void)
997997
, _sprite3D2(nullptr)
998998
{
999999
}
1000-
CameraArcBallDemo::~CameraArcBallDemo(void)
1000+
CameraArcBallDemo::~CameraArcBallDemo()
10011001
{
10021002
}
10031003

@@ -1204,7 +1204,7 @@ void CameraArcBallDemo::update(float dt)
12041204

12051205
////////////////////////////////////////////////////////////
12061206
// FogTestDemo
1207-
FogTestDemo::FogTestDemo(void)
1207+
FogTestDemo::FogTestDemo()
12081208
: CameraBaseTest()
12091209
, _layer3D(nullptr)
12101210
, _cameraType(CameraType::Free)
@@ -1213,7 +1213,7 @@ FogTestDemo::FogTestDemo(void)
12131213
, _state(nullptr)
12141214
{
12151215
}
1216-
FogTestDemo::~FogTestDemo(void)
1216+
FogTestDemo::~FogTestDemo()
12171217
{
12181218
}
12191219

‎tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ BaseTestConsole::BaseTestConsole()
5555
{
5656
}
5757

58-
BaseTestConsole::~BaseTestConsole(void)
58+
BaseTestConsole::~BaseTestConsole()
5959
{
6060
}
6161

‎tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ std::string Issue631::subtitle() const
307307
//
308308
//------------------------------------------------------------------
309309

310-
void EffectAdvanceBaseTest::onEnter(void)
310+
void EffectAdvanceBaseTest::onEnter()
311311
{
312312
TestCase::onEnter();
313313

@@ -344,7 +344,7 @@ void EffectAdvanceBaseTest::onEnter(void)
344344

345345
}
346346

347-
EffectAdvanceBaseTest::~EffectAdvanceBaseTest(void)
347+
EffectAdvanceBaseTest::~EffectAdvanceBaseTest()
348348
{
349349
}
350350

‎tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,6 @@ void EffectBaseTest::checkAnim(float dt)
402402
_gridNodeTarget->setGrid(nullptr);
403403
}
404404

405-
EffectBaseTest::~EffectBaseTest(void)
405+
EffectBaseTest::~EffectBaseTest()
406406
{
407407
}

‎tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ SocketIOTest::SocketIOTest()
108108
}
109109

110110

111-
SocketIOTest::~SocketIOTest(void)
111+
SocketIOTest::~SocketIOTest()
112112
{
113113
}
114114

‎tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ std::string Issue12226::subtitle() const
237237
//
238238
//------------------------------------------------------------------
239239

240-
MotionStreakTest::MotionStreakTest(void)
240+
MotionStreakTest::MotionStreakTest()
241241
{
242242
}
243243

244-
MotionStreakTest::~MotionStreakTest(void)
244+
MotionStreakTest::~MotionStreakTest()
245245
{
246246
}
247247

‎tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ void NavMeshDisabled::onEnter()
6363
}
6464
#else
6565

66-
NavMeshBaseTestDemo::NavMeshBaseTestDemo(void)
66+
NavMeshBaseTestDemo::NavMeshBaseTestDemo()
6767
: _camera(nullptr)
6868
, _needMoveAgents(false)
6969
{
7070

7171
}
7272

73-
NavMeshBaseTestDemo::~NavMeshBaseTestDemo(void)
73+
NavMeshBaseTestDemo::~NavMeshBaseTestDemo()
7474
{
7575
for (auto iter : _agents){
7676
AgentUserData *data = static_cast<AgentUserData *>(iter.first->getUserData());
@@ -263,12 +263,12 @@ void NavMeshBaseTestDemo::update(float delta)
263263
}
264264
}
265265

266-
NavMeshBasicTestDemo::NavMeshBasicTestDemo(void)
266+
NavMeshBasicTestDemo::NavMeshBasicTestDemo()
267267
{
268268

269269
}
270270

271-
NavMeshBasicTestDemo::~NavMeshBasicTestDemo(void)
271+
NavMeshBasicTestDemo::~NavMeshBasicTestDemo()
272272
{
273273
}
274274

@@ -335,12 +335,12 @@ void NavMeshBasicTestDemo::onEnter()
335335
createAgent(result.hitPosition);
336336
}
337337

338-
NavMeshAdvanceTestDemo::NavMeshAdvanceTestDemo(void)
338+
NavMeshAdvanceTestDemo::NavMeshAdvanceTestDemo()
339339
{
340340

341341
}
342342

343-
NavMeshAdvanceTestDemo::~NavMeshAdvanceTestDemo(void)
343+
NavMeshAdvanceTestDemo::~NavMeshAdvanceTestDemo()
344344
{
345345

346346
}

‎tests/cpp-tests/Classes/NodeTest/NodeTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ CocosNodeTests::CocosNodeTests()
7676
ADD_TEST_CASE(Issue16735Test);
7777
}
7878

79-
TestCocosNodeDemo::TestCocosNodeDemo(void)
79+
TestCocosNodeDemo::TestCocosNodeDemo()
8080
{
8181
}
8282

83-
TestCocosNodeDemo::~TestCocosNodeDemo(void)
83+
TestCocosNodeDemo::~TestCocosNodeDemo()
8484
{
8585
}
8686

‎tests/cpp-tests/Classes/Particle3DTest/Particle3DTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void Particle3DTestDemo::onTouchesEnded(const std::vector<Touch*>& touches, coco
113113

114114
}
115115

116-
Particle3DTestDemo::Particle3DTestDemo( void )
116+
Particle3DTestDemo::Particle3DTestDemo()
117117
: _angle(0.0f)
118118
{
119119

@@ -138,7 +138,7 @@ void Particle3DTestDemo::update( float delta )
138138
}
139139
}
140140

141-
Particle3DTestDemo::~Particle3DTestDemo( void )
141+
Particle3DTestDemo::~Particle3DTestDemo()
142142
{
143143
_particleLab->release();
144144
}

‎tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,12 @@ ParticleTests::ParticleTests()
10751075
ADD_TEST_CASE(ParticleSpriteFrame);
10761076
}
10771077

1078-
ParticleDemo::~ParticleDemo(void)
1078+
ParticleDemo::~ParticleDemo()
10791079
{
10801080
CC_SAFE_RELEASE(_emitter);
10811081
}
10821082

1083-
void ParticleDemo::onEnter(void)
1083+
void ParticleDemo::onEnter()
10841084
{
10851085
TestCase::onEnter();
10861086

‎tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void Physics3DTestDemo::onTouchesEnded(const std::vector<Touch*>& touches, cocos
176176
}
177177
}
178178

179-
Physics3DTestDemo::Physics3DTestDemo( void )
179+
Physics3DTestDemo::Physics3DTestDemo()
180180
: _angle(0.0f)
181181
, _camera(nullptr)
182182
{
@@ -188,7 +188,7 @@ void Physics3DTestDemo::update( float /*delta*/ )
188188

189189
}
190190

191-
Physics3DTestDemo::~Physics3DTestDemo( void )
191+
Physics3DTestDemo::~Physics3DTestDemo()
192192
{
193193

194194
}

‎tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ namespace
180180
return (LOGO_IMAGE[(x >> 3) + y * LOGO_RAW_LENGTH] >> (~x & 0x7)) & 1;
181181
}
182182

183-
float frand(void)
183+
float frand()
184184
{
185185
return rand() / RAND_MAX;
186186
}

‎tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ TileDemo::TileDemo()
9494
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
9595
}
9696

97-
TileDemo::~TileDemo(void)
97+
TileDemo::~TileDemo()
9898
{
9999
}
100100

‎tests/cpp-tests/Classes/TouchesTest/Ball.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
USING_NS_CC;
3030

31-
Ball::Ball(void)
31+
Ball::Ball()
3232
{
3333
}
3434

35-
Ball::~Ball(void)
35+
Ball::~Ball()
3636
{
3737
}
3838

‎tests/cpp-tests/Classes/TouchesTest/Paddle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626

2727
USING_NS_CC;
2828

29-
Paddle::Paddle(void)
29+
Paddle::Paddle()
3030
{
3131
}
3232

33-
Paddle::~Paddle(void)
33+
Paddle::~Paddle()
3434
{
3535
}
3636

0 commit comments

Comments
 (0)