@@ -259,8 +259,8 @@ void CheckOther::checkBitwiseOnBoolean()
259259
260260void CheckOther::bitwiseOnBooleanError (const Token *tok, const std::string &varname, const std::string &op)
261261{
262- reportInconclusiveError (tok, Severity::style, " bitwiseOnBoolean" ,
263- " Boolean variable '" + varname + " ' is used in bitwise operation. Did you mean " + op + " ?" );
262+ reportError (tok, Severity::style, " bitwiseOnBoolean" ,
263+ " Boolean variable '" + varname + " ' is used in bitwise operation. Did you mean " + op + " ?" , true );
264264}
265265
266266void CheckOther::checkSuspiciousSemicolon ()
@@ -291,8 +291,8 @@ void CheckOther::checkSuspiciousSemicolon()
291291
292292void CheckOther::SuspiciousSemicolonError (const Token* tok)
293293{
294- reportInconclusiveError (tok, Severity::warning, " suspiciousSemicolon" ,
295- " Suspicious use of ; at the end of 'if/for/while' statement." );
294+ reportError (tok, Severity::warning, " suspiciousSemicolon" ,
295+ " Suspicious use of ; at the end of 'if/for/while' statement." , true );
296296}
297297
298298
@@ -418,7 +418,7 @@ void CheckOther::invalidPointerCastError(const Token* tok, const std::string& fr
418418 if (!inconclusive)
419419 reportError (tok, Severity::portability, " invalidPointerCast" , " Casting from " + from + " * to integer* is not portable due to different binary data representations on different platforms" );
420420 else
421- reportInconclusiveError (tok, Severity::portability, " invalidPointerCast" , " Casting from " + from + " * to char* might be not portable due to different binary data representations on different platforms" );
421+ reportError (tok, Severity::portability, " invalidPointerCast" , " Casting from " + from + " * to char* might be not portable due to different binary data representations on different platforms" , true );
422422 } else
423423 reportError (tok, Severity::warning, " invalidPointerCast" , " Casting between " + from + " * and " + to + " * which have an incompatible binary data representation" );
424424}
@@ -613,11 +613,11 @@ void CheckOther::checkSizeofForPointerSize()
613613
614614void CheckOther::sizeofForPointerError (const Token *tok, const std::string &varname)
615615{
616- reportInconclusiveError (tok, Severity::warning, " pointerSize" ,
617- " Using size of pointer " + varname + " instead of size of its data.\n "
618- " Using size of pointer " + varname + " instead of size of its data. "
619- " This is likely to lead to a buffer overflow. You probably intend to "
620- " write sizeof(*" + varname + " )" );
616+ reportError (tok, Severity::warning, " pointerSize" ,
617+ " Using size of pointer " + varname + " instead of size of its data.\n "
618+ " Using size of pointer " + varname + " instead of size of its data. "
619+ " This is likely to lead to a buffer overflow. You probably intend to "
620+ " write sizeof(*" + varname + " )" , true );
621621}
622622
623623// ---------------------------------------------------------------------------
@@ -1810,24 +1810,15 @@ void CheckOther::checkUnreachableCode()
18101810
18111811void CheckOther::duplicateBreakError (const Token *tok, bool inconclusive)
18121812{
1813- if (inconclusive)
1814- reportInconclusiveError (tok, Severity::style, " duplicateBreak" ,
1815- " Consecutive return, break, continue, goto or throw statements are unnecessary.\n "
1816- " The second of the two statements can never be executed, and so should be removed." );
1817- else
1818- reportError (tok, Severity::style, " duplicateBreak" ,
1819- " Consecutive return, break, continue, goto or throw statements are unnecessary.\n "
1820- " The second of the two statements can never be executed, and so should be removed." );
1813+ reportError (tok, Severity::style, " duplicateBreak" ,
1814+ " Consecutive return, break, continue, goto or throw statements are unnecessary.\n "
1815+ " The second of the two statements can never be executed, and so should be removed." , inconclusive);
18211816}
18221817
18231818void CheckOther::unreachableCodeError (const Token *tok, bool inconclusive)
18241819{
1825- if (inconclusive)
1826- reportInconclusiveError (tok, Severity::style, " unreachableCode" ,
1827- " Statements following return, break, continue, goto or throw will never be executed." );
1828- else
1829- reportError (tok, Severity::style, " unreachableCode" ,
1830- " Statements following return, break, continue, goto or throw will never be executed." );
1820+ reportError (tok, Severity::style, " unreachableCode" ,
1821+ " Statements following return, break, continue, goto or throw will never be executed." , inconclusive);
18311822}
18321823
18331824// ---------------------------------------------------------------------------
@@ -1877,7 +1868,7 @@ void CheckOther::checkUnsignedDivision()
18771868void CheckOther::udivError (const Token *tok, bool inconclusive)
18781869{
18791870 if (inconclusive)
1880- reportInconclusiveError (tok, Severity::warning, " udivError" , " Division with signed and unsigned operators. The result might be wrong." );
1871+ reportError (tok, Severity::warning, " udivError" , " Division with signed and unsigned operators. The result might be wrong." , true );
18811872 else
18821873 reportError (tok, Severity::error, " udivError" , " Unsigned division. The result will be wrong." );
18831874}
@@ -3206,12 +3197,8 @@ void CheckOther::sizeofCalculation()
32063197
32073198void CheckOther::sizeofCalculationError (const Token *tok, bool inconclusive)
32083199{
3209- if (inconclusive)
3210- reportInconclusiveError (tok, Severity::warning,
3211- " sizeofCalculation" , " Found calculation inside sizeof()" );
3212- else
3213- reportError (tok, Severity::warning,
3214- " sizeofCalculation" , " Found calculation inside sizeof()" );
3200+ reportError (tok, Severity::warning,
3201+ " sizeofCalculation" , " Found calculation inside sizeof()" , inconclusive);
32153202}
32163203
32173204// -----------------------------------------------------------------------------
@@ -3342,12 +3329,12 @@ void CheckOther::checkSignOfUnsignedVariable()
33423329void CheckOther::unsignedLessThanZeroError (const Token *tok, const std::string &varname, bool inconclusive)
33433330{
33443331 if (inconclusive) {
3345- reportInconclusiveError (tok, Severity::style, " unsignedLessThanZero" ,
3346- " Checking if unsigned variable '" + varname + " ' is less than zero. This might be a false warning.\n "
3347- " Checking if unsigned variable '" + varname + " ' is less than zero. An unsigned "
3348- " variable will never be negative so it is either pointless or an error to check if it is. "
3349- " It's not known if the used constant is a template parameter or not and therefore "
3350- " this message might be a false warning" );
3332+ reportError (tok, Severity::style, " unsignedLessThanZero" ,
3333+ " Checking if unsigned variable '" + varname + " ' is less than zero. This might be a false warning.\n "
3334+ " Checking if unsigned variable '" + varname + " ' is less than zero. An unsigned "
3335+ " variable will never be negative so it is either pointless or an error to check if it is. "
3336+ " It's not known if the used constant is a template parameter or not and therefore "
3337+ " this message might be a false warning" , true );
33513338 } else {
33523339 reportError (tok, Severity::style, " unsignedLessThanZero" ,
33533340 " Checking if unsigned variable '" + varname + " ' is less than zero.\n "
@@ -3359,11 +3346,11 @@ void CheckOther::unsignedLessThanZeroError(const Token *tok, const std::string &
33593346void CheckOther::unsignedPositiveError (const Token *tok, const std::string &varname, bool inconclusive)
33603347{
33613348 if (inconclusive) {
3362- reportInconclusiveError (tok, Severity::style, " unsignedPositive" ,
3363- " An unsigned variable '" + varname + " ' can't be negative so it is unnecessary to test it. This might be a false warning.\n "
3364- " An unsigned variable '" + varname + " ' can't be negative so it is unnecessary to test it. "
3365- " It's not known if the used constant is a "
3366- " template parameter or not and therefore this message might be a false warning" );
3349+ reportError (tok, Severity::style, " unsignedPositive" ,
3350+ " An unsigned variable '" + varname + " ' can't be negative so it is unnecessary to test it. This might be a false warning.\n "
3351+ " An unsigned variable '" + varname + " ' can't be negative so it is unnecessary to test it. "
3352+ " It's not known if the used constant is a "
3353+ " template parameter or not and therefore this message might be a false warning" , true );
33673354 } else {
33683355 reportError (tok, Severity::style, " unsignedPositive" ,
33693356 " An unsigned variable '" + varname + " ' can't be negative so it is unnecessary to test it." );
0 commit comments