Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
487447a5
Commit
487447a5
authored
Nov 30, 2023
by
Paul
Browse files
Some more improvements to checkers
parent
9e405e27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
tools/cppcheck/migraphx.py
tools/cppcheck/migraphx.py
+7
-1
No files found.
tools/cppcheck/migraphx.py
View file @
487447a5
...
...
@@ -202,7 +202,7 @@ def LambdaAttribute(cfg, data):
for
token
in
cfg
.
tokenlist
:
if
token
.
str
!=
']'
:
continue
if
not
match
(
token
,
"] __device__|__host__ {|
{}}
"
):
if
not
match
(
token
,
"] __device__|__host__ {|
(
"
):
continue
cppcheck
.
reportError
(
token
,
"style"
,
...
...
@@ -238,6 +238,8 @@ def MutableVariable(cfg, data):
@
cppcheck
.
checker
def
NestedBlocks
(
cfg
,
data
):
for
token
in
cfg
.
tokenlist
:
if
not
token
.
str
in
[
'if'
,
'while'
,
'for'
,
'switch'
]:
continue
block
=
match
(
token
,
"if|while|for|switch (*) { {*}@block }"
).
block
if
not
block
:
block
=
match
(
token
,
"; { {*}@block break ; }"
).
block
...
...
@@ -249,6 +251,8 @@ def NestedBlocks(cfg, data):
@
cppcheck
.
checker
def
RedundantCast
(
cfg
,
data
):
for
token
in
cfg
.
tokenlist
:
if
not
token
.
variable
:
continue
m
=
match
(
token
,
"%var%@decl ; %var%@assign = static_cast <*>@cast (*) ;"
)
if
not
m
:
...
...
@@ -289,6 +293,8 @@ def RedundantIfStatement(cfg, data):
@
cppcheck
.
checker
def
RedundantLocalVariable
(
cfg
,
data
):
for
token
in
cfg
.
tokenlist
:
if
not
token
.
variable
:
continue
m
=
match
(
token
,
"%var%@decl ; %var%@assign = **; return %var%@returned ;"
)
if
not
m
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment