Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
7dc3d1bf
Commit
7dc3d1bf
authored
Sep 29, 2018
by
Paul
Browse files
Add check for unnecessary else statement
parent
3ff10e1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
cppcheck.rules
cppcheck.rules
+9
-0
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+1
-4
No files found.
cppcheck.rules
View file @
7dc3d1bf
...
@@ -243,6 +243,15 @@
...
@@ -243,6 +243,15 @@
<summary>
The if statement is redundant.
</summary>
<summary>
The if statement is redundant.
</summary>
</message>
</message>
</rule>
</rule>
<rule>
<tokenlist>
normal
</tokenlist>
<pattern>
<![CDATA[if \( [^()]+ \) { [^{}]* (return|throw|break|continue) [^;]* ; } else {]]>
</pattern>
<message>
<id>
UnnecessaryElseStatement
</id>
<severity>
style
</severity>
<summary>
Else statement is not necessary.
</summary>
</message>
</rule>
<rule>
<rule>
<tokenlist>
normal
</tokenlist>
<tokenlist>
normal
</tokenlist>
<pattern>
<![CDATA[for \( \w+ (\w+) = \w+ ; \1 < \w+ ; (\1 \+\+|\+\+ \1|\1 \-\-|\-\- \1) \) { \w+ \[ \1 \] = \w+ \[ \1 \] ; }]]>
</pattern>
<pattern>
<![CDATA[for \( \w+ (\w+) = \w+ ; \1 < \w+ ; (\1 \+\+|\+\+ \1|\1 \-\-|\-\- \1) \) { \w+ \[ \1 \] = \w+ \[ \1 \] ; }]]>
</pattern>
...
...
test/gpu/miopen.cpp
View file @
7dc3d1bf
...
@@ -35,10 +35,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
...
@@ -35,10 +35,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
std
::
thread
(
std
::
move
(
task
)).
detach
();
std
::
thread
(
std
::
move
(
task
)).
detach
();
return
std
::
move
(
fut
);
return
std
::
move
(
fut
);
}
}
else
return
std
::
async
(
std
::
launch
::
deferred
,
std
::
forward
<
Function
>
(
f
));
{
return
std
::
async
(
std
::
launch
::
deferred
,
std
::
forward
<
Function
>
(
f
));
}
}
}
struct
auto_print
struct
auto_print
...
...
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