diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 31d786e24..81dbb9c68 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -657,7 +657,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) const std::string& name((*it)->name()); const std::string info((*it)->classInfo()); if (!name.empty() && !info.empty()) - doc << "===" << name << "===\n" + doc << "## " << name << " ##\n" << info << "\n"; } diff --git a/lib/check64bit.h b/lib/check64bit.h index 170dfe8f0..ce3b849fc 100644 --- a/lib/check64bit.h +++ b/lib/check64bit.h @@ -81,8 +81,8 @@ private: std::string classInfo() const { return "Check if there is 64-bit portability issues:\n" - "* assign address to/from int/long\n" - "* casting address from/to integer when returning from function\n"; + "- assign address to/from int/long\n" + "- casting address from/to integer when returning from function\n"; } }; /// @} diff --git a/lib/checkautovariables.h b/lib/checkautovariables.h index eed95a8c2..c554332f3 100644 --- a/lib/checkautovariables.h +++ b/lib/checkautovariables.h @@ -110,12 +110,12 @@ private: std::string classInfo() const { return "A pointer to a variable is only valid as long as the variable is in scope.\n" "Check:\n" - "* returning a pointer to auto or temporary variable\n" - "* assigning address of an variable to an effective parameter of a function\n" - "* returning reference to local/temporary variable\n" - "* returning address of function parameter\n" - "* suspicious assignment of pointer argument\n" - "* useless assignment of function argument\n"; + "- returning a pointer to auto or temporary variable\n" + "- assigning address of an variable to an effective parameter of a function\n" + "- returning reference to local/temporary variable\n" + "- returning address of function parameter\n" + "- suspicious assignment of pointer argument\n" + "- useless assignment of function argument\n"; } }; /// @} diff --git a/lib/checkbool.h b/lib/checkbool.h index 05fb33875..4d69d1602 100644 --- a/lib/checkbool.h +++ b/lib/checkbool.h @@ -130,14 +130,13 @@ private: std::string classInfo() const { return "Boolean type checks\n" - - "* using increment on boolean\n" - "* comparison of a boolean with a non-zero integer\n" - "* comparison of a boolean expression with an integer other than 0 or 1\n" - "* comparison of a function returning boolean value using relational operator\n" - "* comparison of a boolean value with boolean value using relational operator\n" - "* using bool in bitwise expression\n" - "* pointer addition in condition (either dereference is forgot or pointer overflow is required to make the condition false)\n"; + "- using increment on boolean\n" + "- comparison of a boolean with a non-zero integer\n" + "- comparison of a boolean expression with an integer other than 0 or 1\n" + "- comparison of a function returning boolean value using relational operator\n" + "- comparison of a boolean value with boolean value using relational operator\n" + "- using bool in bitwise expression\n" + "- pointer addition in condition (either dereference is forgot or pointer overflow is required to make the condition false)\n"; } }; /// @} diff --git a/lib/checkboost.h b/lib/checkboost.h index 048839937..aa5daf9a5 100644 --- a/lib/checkboost.h +++ b/lib/checkboost.h @@ -70,7 +70,7 @@ private: std::string classInfo() const { return "Check for invalid usage of Boost:\n" - "* container modification during BOOST_FOREACH\n"; + "- container modification during BOOST_FOREACH\n"; } }; /// @} diff --git a/lib/checkbufferoverrun.h b/lib/checkbufferoverrun.h index 2b02f1946..0b4ea8dd3 100644 --- a/lib/checkbufferoverrun.h +++ b/lib/checkbufferoverrun.h @@ -258,16 +258,16 @@ private: std::string classInfo() const { return "Out of bounds checking:\n" - "* Array index out of bounds detection by value flow analysis\n" - "* Dangerous usage of strncat()\n" - "* char constant passed as size to function like memset()\n" - "* strncpy() leaving string unterminated\n" - "* Accessing array with negative index\n" - "* Unsafe usage of main(argv, argc) arguments\n" - "* Accessing array with index variable before checking its value\n" - "* Check for large enough arrays being passed to functions\n" - "* Writing beyond bounds of a buffer\n" - "* Allocating memory with a negative size\n"; + "- Array index out of bounds detection by value flow analysis\n" + "- Dangerous usage of strncat()\n" + "- char constant passed as size to function like memset()\n" + "- strncpy() leaving string unterminated\n" + "- Accessing array with negative index\n" + "- Unsafe usage of main(argv, argc) arguments\n" + "- Accessing array with index variable before checking its value\n" + "- Check for large enough arrays being passed to functions\n" + "- Writing beyond bounds of a buffer\n" + "- Allocating memory with a negative size\n"; } }; /// @} diff --git a/lib/checkclass.h b/lib/checkclass.h index 6e995ae46..e3d6d9cf3 100644 --- a/lib/checkclass.h +++ b/lib/checkclass.h @@ -193,23 +193,23 @@ private: std::string classInfo() const { return "Check the code for each class.\n" - "* Missing constructors and copy constructors\n" - //"* Missing allocation of memory in copy constructor\n" - "* Are all variables initialized by the constructors?\n" - "* Are all variables assigned by 'operator='?\n" - "* Warn if memset, memcpy etc are used on a class\n" - "* Warn if memory for classes is allocated with malloc()\n" - "* If it's a base class, check that the destructor is virtual\n" - "* Are there unused private functions?\n" - "* 'operator=' should return reference to self\n" - "* 'operator=' should check for assignment to self\n" - "* Constness for member functions\n" - "* Order of initializations\n" - "* Suggest usage of initialization list\n" - "* Initialization of a member with itself\n" - "* Suspicious subtraction from 'this'\n" - "* Call of pure virtual function in constructor/destructor\n" - "* Duplicated inherited data members\n"; + "- Missing constructors and copy constructors\n" + //"- Missing allocation of memory in copy constructor\n" + "- Are all variables initialized by the constructors?\n" + "- Are all variables assigned by 'operator='?\n" + "- Warn if memset, memcpy etc are used on a class\n" + "- Warn if memory for classes is allocated with malloc()\n" + "- If it's a base class, check that the destructor is virtual\n" + "- Are there unused private functions?\n" + "- 'operator=' should return reference to self\n" + "- 'operator=' should check for assignment to self\n" + "- Constness for member functions\n" + "- Order of initializations\n" + "- Suggest usage of initialization list\n" + "- Initialization of a member with itself\n" + "- Suspicious subtraction from 'this'\n" + "- Call of pure virtual function in constructor/destructor\n" + "- Duplicated inherited data members\n"; } // operatorEqRetRefThis helper functions diff --git a/lib/checkcondition.h b/lib/checkcondition.h index 39f7f031f..681caf2ed 100644 --- a/lib/checkcondition.h +++ b/lib/checkcondition.h @@ -130,14 +130,14 @@ private: std::string classInfo() const { return "Match conditions with assignments and other conditions:\n" - "* Mismatching assignment and comparison => comparison is always true/false\n" - "* Mismatching lhs and rhs in comparison => comparison is always true/false\n" - "* Detect matching 'if' and 'else if' conditions\n" - "* Mismatching bitand (a &= 0xf0; a &= 1; => a = 0)\n" - "* Find dead code which is inaccessible due to the counter-conditions check in nested if statements\n" - "* condition that is always true/false\n" - "* mutual exclusion over || always evaluating to true\n" - "* Comparisons of modulo results that are always true/false.\n"; + "- Mismatching assignment and comparison => comparison is always true/false\n" + "- Mismatching lhs and rhs in comparison => comparison is always true/false\n" + "- Detect matching 'if' and 'else if' conditions\n" + "- Mismatching bitand (a &= 0xf0; a &= 1; => a = 0)\n" + "- Find dead code which is inaccessible due to the counter-conditions check in nested if statements\n" + "- condition that is always true/false\n" + "- mutual exclusion over || always evaluating to true\n" + "- Comparisons of modulo results that are always true/false.\n"; } }; /// @} diff --git a/lib/checkexceptionsafety.h b/lib/checkexceptionsafety.h index 704f4db24..d370eb694 100644 --- a/lib/checkexceptionsafety.h +++ b/lib/checkexceptionsafety.h @@ -163,15 +163,15 @@ private: /** wiki formatted description of the class (for --doc) */ std::string classInfo() const { return "Checking exception safety\n" - "* Throwing exceptions in destructors\n" - "* Throwing exception during invalid state\n" - "* Throwing a copy of a caught exception instead of rethrowing the original exception\n" - "* Exception caught by value instead of by reference\n" - "* Throwing exception in noexcept function\n" - "* Throwing exception in nothrow() function\n" - "* Throwing exception in __attribute__((nothrow)) function\n" - "* Throwing exception in __declspec(nothrow) function\n" - "* Unhandled exception specification when calling function foo()\n"; + "- Throwing exceptions in destructors\n" + "- Throwing exception during invalid state\n" + "- Throwing a copy of a caught exception instead of rethrowing the original exception\n" + "- Exception caught by value instead of by reference\n" + "- Throwing exception in noexcept function\n" + "- Throwing exception in nothrow() function\n" + "- Throwing exception in __attribute__((nothrow)) function\n" + "- Throwing exception in __declspec(nothrow) function\n" + "- Unhandled exception specification when calling function foo()\n"; } }; /// @} diff --git a/lib/checkio.h b/lib/checkio.h index 9a24a9cf6..12bf3cde6 100644 --- a/lib/checkio.h +++ b/lib/checkio.h @@ -150,20 +150,20 @@ private: } static std::string myName() { - return "IO"; + return "IO using format string"; } std::string classInfo() const { - return "Check input/output operations.\n" - "* Bad usage of the function 'sprintf' (overlapping data)\n" - "* Missing or wrong width specifiers in 'scanf' format string\n" - "* Use a file that has been closed\n" - "* File input/output without positioning results in undefined behaviour\n" - "* Read to a file that has only been opened for writing (or vice versa)\n" - "* Repositioning operation on a file opened in append mode\n" - "* Using fflush() on an input stream\n" - "* Invalid usage of output stream. For example: 'std::cout << std::cout;'\n" - "* Wrong number of arguments given to 'printf' or 'scanf;'\n"; + return "Check format string input/output operations.\n" + "- Bad usage of the function 'sprintf' (overlapping data)\n" + "- Missing or wrong width specifiers in 'scanf' format string\n" + "- Use a file that has been closed\n" + "- File input/output without positioning results in undefined behaviour\n" + "- Read to a file that has only been opened for writing (or vice versa)\n" + "- Repositioning operation on a file opened in append mode\n" + "- Using fflush() on an input stream\n" + "- Invalid usage of output stream. For example: 'std::cout << std::cout;'\n" + "- Wrong number of arguments given to 'printf' or 'scanf;'\n"; } }; /// @} diff --git a/lib/checknullpointer.h b/lib/checknullpointer.h index eb192b6cc..4d1af3f13 100644 --- a/lib/checknullpointer.h +++ b/lib/checknullpointer.h @@ -105,7 +105,7 @@ private: /** class info in WIKI format. Used by --doc */ std::string classInfo() const { return "Null pointers\n" - "* null pointer dereferencing\n"; + "- null pointer dereferencing\n"; } /** diff --git a/lib/checkother.h b/lib/checkother.h index 111fa9919..4bf256843 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -353,59 +353,59 @@ private: return "Other checks\n" // error - "* Assigning bool value to pointer (converting bool value to address)\n" - "* division with zero\n" - "* scoped object destroyed immediately after construction\n" - "* assignment in an assert statement\n" - "* free() or delete of an invalid memory location\n" - "* double free() or double closedir()\n" - "* bitwise operation with negative right operand\n" - "* provide wrong dimensioned array to pipe() system command (--std=posix)\n" - "* cast the return values of getc(),fgetc() and getchar() to character and compare it to EOF\n" - "* invalid input values for functions\n" + "- Assigning bool value to pointer (converting bool value to address)\n" + "- division with zero\n" + "- scoped object destroyed immediately after construction\n" + "- assignment in an assert statement\n" + "- free() or delete of an invalid memory location\n" + "- double free() or double closedir()\n" + "- bitwise operation with negative right operand\n" + "- provide wrong dimensioned array to pipe() system command (--std=posix)\n" + "- cast the return values of getc(),fgetc() and getchar() to character and compare it to EOF\n" + "- invalid input values for functions\n" // warning - "* either division by zero or useless condition\n" - "* memset() with a value out of range as the 2nd parameter\n" - "* return value of certain functions not used\n" + "- either division by zero or useless condition\n" + "- memset() with a value out of range as the 2nd parameter\n" + "- return value of certain functions not used\n" // performance - "* redundant data copying for const variable\n" - "* subsequent assignment or copying to a variable or buffer\n" + "- redundant data copying for const variable\n" + "- subsequent assignment or copying to a variable or buffer\n" // portability - "* memset() with a float as the 2nd parameter\n" + "- memset() with a float as the 2nd parameter\n" // style - "* C-style pointer cast in cpp file\n" - "* casting between incompatible pointer types\n" - "* redundant if\n" - "* passing parameter by value\n" - "* [[IncompleteStatement|Incomplete statement]]\n" - "* [[charvar|check how signed char variables are used]]\n" - "* variable scope can be limited\n" - "* unusual pointer arithmetic. For example: \"abc\" + 'd'\n" - "* redundant assignment in a switch statement\n" - "* redundant pre/post operation in a switch statement\n" - "* redundant bitwise operation in a switch statement\n" - "* redundant strcpy in a switch statement\n" - "* assignment of a variable to itself\n" - "* Suspicious case labels in switch()\n" - "* Suspicious equality comparisons\n" - "* Comparison of values leading always to true or false\n" - "* Clarify calculation with parentheses\n" - "* suspicious comparison of '\\0' with a char* variable\n" - "* duplicate break statement\n" - "* unreachable code\n" - "* testing if unsigned variable is negative\n" - "* testing is unsigned variable is positive\n" - "* Suspicious use of ; at the end of 'if/for/while' statement.\n" - "* Array filled incompletely using memset/memcpy/memmove.\n" - "* redundant get and set function of user id (--std=posix).\n" - "* Passing NULL pointer to function with variable number of arguments leads to UB on some platforms.\n" - "* NaN (not a number) value used in arithmetic expression.\n" - "* comma in return statement (the comma can easily be misread as a semicolon).\n" - "* prefer erfc, expm1 or log1p to avoid loss of precision.\n"; + "- C-style pointer cast in cpp file\n" + "- casting between incompatible pointer types\n" + "- redundant if\n" + "- passing parameter by value\n" + "- [Incomplete statement](IncompleteStatement)\n" + "- [check how signed char variables are used](CharVar)\n" + "- variable scope can be limited\n" + "- unusual pointer arithmetic. For example: \"abc\" + 'd'\n" + "- redundant assignment in a switch statement\n" + "- redundant pre/post operation in a switch statement\n" + "- redundant bitwise operation in a switch statement\n" + "- redundant strcpy in a switch statement\n" + "- assignment of a variable to itself\n" + "- Suspicious case labels in switch()\n" + "- Suspicious equality comparisons\n" + "- Comparison of values leading always to true or false\n" + "- Clarify calculation with parentheses\n" + "- suspicious comparison of '\\0' with a char* variable\n" + "- duplicate break statement\n" + "- unreachable code\n" + "- testing if unsigned variable is negative\n" + "- testing is unsigned variable is positive\n" + "- Suspicious use of ; at the end of 'if/for/while' statement.\n" + "- Array filled incompletely using memset/memcpy/memmove.\n" + "- redundant get and set function of user id (--std=posix).\n" + "- Passing NULL pointer to function with variable number of arguments leads to UB on some platforms.\n" + "- NaN (not a number) value used in arithmetic expression.\n" + "- comma in return statement (the comma can easily be misread as a semicolon).\n" + "- prefer erfc, expm1 or log1p to avoid loss of precision.\n"; } }; /// @} diff --git a/lib/checksizeof.h b/lib/checksizeof.h index 4350c2b03..15c8783bf 100644 --- a/lib/checksizeof.h +++ b/lib/checksizeof.h @@ -120,13 +120,13 @@ private: std::string classInfo() const { return "sizeof() usage checks\n" - "* sizeof for array given as function argument\n" - "* sizeof for numeric given as function argument\n" - "* using sizeof(pointer) instead of the size of pointed data\n" - "* look for 'sizeof sizeof ..'\n" - "* look for calculations inside sizeof()\n" - "* look for suspicious calculations with sizeof()\n" - "* using 'sizeof(void)' which is undefined\n"; + "- sizeof for array given as function argument\n" + "- sizeof for numeric given as function argument\n" + "- using sizeof(pointer) instead of the size of pointed data\n" + "- look for 'sizeof sizeof ..'\n" + "- look for calculations inside sizeof()\n" + "- look for suspicious calculations with sizeof()\n" + "- using 'sizeof(void)' which is undefined\n"; } }; /// @} diff --git a/lib/checkstl.h b/lib/checkstl.h index 29668715a..df2f5614a 100644 --- a/lib/checkstl.h +++ b/lib/checkstl.h @@ -225,19 +225,19 @@ private: std::string classInfo() const { return "Check for invalid usage of STL:\n" - "* out of bounds errors\n" - "* misuse of iterators when iterating through a container\n" - "* mismatching containers in calls\n" - "* dereferencing an erased iterator\n" - "* for vectors: using iterator/pointer after push_back has been used\n" - "* optimisation: use empty() instead of size() to guarantee fast code\n" - "* suspicious condition when using find\n" - "* redundant condition\n" - "* common mistakes when using string::c_str()\n" - "* using auto pointer (auto_ptr)\n" - "* useless calls of string and STL functions\n" - "* dereferencing an invalid iterator\n" - "* reading from empty STL container\n"; + "- out of bounds errors\n" + "- misuse of iterators when iterating through a container\n" + "- mismatching containers in calls\n" + "- dereferencing an erased iterator\n" + "- for vectors: using iterator/pointer after push_back has been used\n" + "- optimisation: use empty() instead of size() to guarantee fast code\n" + "- suspicious condition when using find\n" + "- redundant condition\n" + "- common mistakes when using string::c_str()\n" + "- using auto pointer (auto_ptr)\n" + "- useless calls of string and STL functions\n" + "- dereferencing an invalid iterator\n" + "- reading from empty STL container\n"; } }; /// @} diff --git a/lib/checkstring.h b/lib/checkstring.h index 270ff3943..b809b73f7 100644 --- a/lib/checkstring.h +++ b/lib/checkstring.h @@ -105,13 +105,12 @@ private: std::string classInfo() const { return "Detect misusage of C-style strings:\n" - - "* overlapping buffers passed to sprintf as source and destination\n" - "* incorrect length arguments for 'substr' and 'strncmp'\n" - "* suspicious condition (runtime comparison of string literals)\n" - "* suspicious condition (string literals as boolean)\n" - "* suspicious comparison of a string literal with a char* variable\n" - "* suspicious comparison of '\\0' with a char* variable\n"; + "- overlapping buffers passed to sprintf as source and destination\n" + "- incorrect length arguments for 'substr' and 'strncmp'\n" + "- suspicious condition (runtime comparison of string literals)\n" + "- suspicious condition (string literals as boolean)\n" + "- suspicious comparison of a string literal with a char* variable\n" + "- suspicious comparison of '\\0' with a char* variable\n"; } }; /// @} diff --git a/lib/checktype.h b/lib/checktype.h index ddd0425c4..392abed9e 100644 --- a/lib/checktype.h +++ b/lib/checktype.h @@ -89,9 +89,9 @@ private: std::string classInfo() const { return "Type checks\n" - "* bitwise shift by too many bits (only enabled when --platform is used)\n" - "* signed integer overflow (only enabled when --platform is used)\n" - "* dangerous sign conversion, when signed value can be negative\n"; + "- bitwise shift by too many bits (only enabled when --platform is used)\n" + "- signed integer overflow (only enabled when --platform is used)\n" + "- dangerous sign conversion, when signed value can be negative\n"; } }; /// @} diff --git a/lib/checkuninitvar.h b/lib/checkuninitvar.h index e994ae6df..de107c4c8 100644 --- a/lib/checkuninitvar.h +++ b/lib/checkuninitvar.h @@ -108,8 +108,9 @@ private: std::string classInfo() const { return "Uninitialized variables\n" - "* using uninitialized variables and data\n" - "* using dead pointer\n"; + "- using uninitialized local variables\n" + "- using allocated data before it has been initialized\n" + "- using dead pointer\n"; } }; /// @} diff --git a/lib/checkunusedvar.h b/lib/checkunusedvar.h index 30fb1abb3..18f766849 100644 --- a/lib/checkunusedvar.h +++ b/lib/checkunusedvar.h @@ -101,11 +101,11 @@ private: return "UnusedVar checks\n" // style - "* unused variable\n" - "* allocated but unused variable\n" - "* unred variable\n" - "* unassigned variable\n" - "* unused struct member\n"; + "- unused variable\n" + "- allocated but unused variable\n" + "- unred variable\n" + "- unassigned variable\n" + "- unused struct member\n"; } std::map isRecordTypeWithoutSideEffectsMap; diff --git a/lib/checkvaarg.h b/lib/checkvaarg.h index fb7dced9d..660862063 100644 --- a/lib/checkvaarg.h +++ b/lib/checkvaarg.h @@ -67,16 +67,16 @@ private: } static std::string myName() { - return "CheckVaarg"; + return "Vaarg"; } std::string classInfo() const { return "Check for misusage of variable argument lists:\n" - "* Wrong parameter passed to va_start()\n" - "* Reference passed to va_start()\n" - "* Missing va_end()\n" - "* Using va_list before it is opened\n" - "* Subsequent calls to va_start/va_copy()\n"; + "- Wrong parameter passed to va_start()\n" + "- Reference passed to va_start()\n" + "- Missing va_end()\n" + "- Using va_list before it is opened\n" + "- Subsequent calls to va_start/va_copy()\n"; } };