summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-03 17:20:46 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-03 17:20:46 +0300
commitee79ea6306416dc67eec03216a4075b1c342fd89 (patch)
tree3070faa4c002bf2350422678903906606e8edd83
parenta3c1145553b12532b18d2f439b01b649dc0d4b6e (diff)
downloadmplint-ee79ea6306416dc67eec03216a4075b1c342fd89.tar.gz
mplint-ee79ea6306416dc67eec03216a4075b1c342fd89.tar.bz2
mplint-ee79ea6306416dc67eec03216a4075b1c342fd89.tar.xz
mplint-ee79ea6306416dc67eec03216a4075b1c342fd89.zip
Add finalize ignore into virtual check.
-rw-r--r--src/rules/virtual.cpp5
-rw-r--r--tests/testreport.txt2
-rw-r--r--tests/testsrc/bad/virtual1.cpp4
-rw-r--r--tests/testsrc/good/virtual1.cpp2
4 files changed, 9 insertions, 4 deletions
diff --git a/src/rules/virtual.cpp b/src/rules/virtual.cpp
index 70f0e36..a52a369 100644
--- a/src/rules/virtual.cpp
+++ b/src/rules/virtual.cpp
@@ -32,6 +32,9 @@ endRule(virtualCheck)
parseLineRule(virtualCheck)
{
- if (isMatch(data, "(.+)virtual[ ](.+)[ ](override|final)(.+)"))
+ if (isMatch(data, "(.+)virtual[ ](.+)[ ](override|final)(.*)") &&
+ data.find("finalize") == std::string::npos)
+ {
print("Keywords virtual is useless if used with override or final");
+ }
}
diff --git a/tests/testreport.txt b/tests/testreport.txt
index 8b47e0b..366e750 100644
--- a/tests/testreport.txt
+++ b/tests/testreport.txt
@@ -44,6 +44,6 @@
[testsrc/bad/packet.cpp:25]: V012: Wrong output packet creation. Must be 'createOutPacket(CMSG...'
[testsrc/bad/uk.po:2257]: V010: Wrong character at end of translation line.
[testsrc/bad/virtual1.cpp:33]: V013: Keywords virtual is useless if used with override or final
-[testsrc/bad/virtual1.cpp:34]: V013: Keywords virtual is useless if used with override or final
+[testsrc/bad/virtual1.cpp:36]: V013: Keywords virtual is useless if used with override or final
[testsrc/bad/virtual1.h:31]: V013: Keywords virtual is useless if used with override or final
[testsrc/bad/virtual1.h:32]: V013: Keywords virtual is useless if used with override or final
diff --git a/tests/testsrc/bad/virtual1.cpp b/tests/testsrc/bad/virtual1.cpp
index cfc4176..77d525a 100644
--- a/tests/testsrc/bad/virtual1.cpp
+++ b/tests/testsrc/bad/virtual1.cpp
@@ -31,6 +31,8 @@ class Test1 final
class Test2 notfinal : public Test1
{
virtual Test2() override;
- virtual Test3() final;
}
+ virtual Test2::Test3() final
+ {
+ } \ No newline at end of file
diff --git a/tests/testsrc/good/virtual1.cpp b/tests/testsrc/good/virtual1.cpp
index 0f72e65..5314e16 100644
--- a/tests/testsrc/good/virtual1.cpp
+++ b/tests/testsrc/good/virtual1.cpp
@@ -24,7 +24,7 @@
class Test1 final
{
- virtual Test1();
+ virtual Test1finalize();
}
class Test2 notfinal : public Test1