From 12c9f0978036db873bbd30130c8e76b0da5b8cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 19 Jun 2009 12:01:27 +0200 Subject: [PATCH] Fixed #420 (WarningOldStylePointerCast() needs a test case) --- src/checkother.h | 2 +- test/testother.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/checkother.h b/src/checkother.h index 1761d48a8..8880d2af8 100644 --- a/src/checkother.h +++ b/src/checkother.h @@ -46,6 +46,7 @@ public: if (settings->_checkCodingStyle) { + checkOther.WarningOldStylePointerCast(); checkOther.CheckUnsignedDivision(); checkOther.CheckCharVariable(); } @@ -57,7 +58,6 @@ public: if (settings->_checkCodingStyle) { - checkOther.WarningOldStylePointerCast(); checkOther.WarningRedundantCode(); checkOther.WarningIf(); checkOther.CheckVariableScope(); diff --git a/test/testother.cpp b/test/testother.cpp index 55fafa41e..eb03581f5 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -450,6 +450,14 @@ private: void oldStylePointerCast() { + checkOldStylePointerCast("class Base;\n" + "void foo()\n" + "{\n" + " Base * b = (Base *) derived;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4]: (style) C-style pointer casting\n", errout.str()); + + checkOldStylePointerCast("class B;\n" "class A\n" "{\n"