diff --git a/lib/checkobsoletefunctions.h b/lib/checkobsoletefunctions.h index 1358cfe4e..ff93793c3 100644 --- a/lib/checkobsoletefunctions.h +++ b/lib/checkobsoletefunctions.h @@ -90,7 +90,10 @@ private: _obsoleteFunctions.push_back(std::make_pair("getwd","Found obsolete function 'getwd'. It is recommended that new applications use the 'getcwd' function")); + /* Disabled to fix #2334 _obsoleteFunctions.push_back(std::make_pair("index","Found obsolete function 'index'. It is recommended to use the function 'strchr' instead")); + */ + _obsoleteFunctions.push_back(std::make_pair("rindex","Found obsolete function 'rindex'. It is recommended to use the function 'strrchr' instead")); _obsoleteFunctions.push_back(std::make_pair("pthread_attr_getstackaddr","Found obsolete function 'pthread_attr_getstackaddr'.It is recommended that new applications use the 'pthread_attr_getstack' function")); diff --git a/test/testobsoletefunctions.cpp b/test/testobsoletefunctions.cpp index 3aab0db6a..7013d9816 100644 --- a/test/testobsoletefunctions.cpp +++ b/test/testobsoletefunctions.cpp @@ -40,6 +40,7 @@ private: TEST_CASE(testgethostbyaddr); TEST_CASE(testusleep); TEST_CASE(testindex); + TEST_CASE(test_qt_index); // FP when using the Qt function 'index'? TEST_CASE(testrindex); // no false positives for variables @@ -165,7 +166,16 @@ private: " const char i = index(var, 0);\n" " return i;\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str()); + ASSERT_EQUALS("", errout.str()); + TODO_ASSERT_EQUALS("[test.cpp:4]: (style) Found obsolete function 'index'. It is recommended to use the function 'strchr' instead\n", errout.str()); + } + + void test_qt_index() + { + check("void TDataModel::forceRowRefresh(int row) {\n" + " emit dataChanged(index(row, 0), index(row, columnCount() - 1));\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void testrindex()