Merge branch 'master' of https://github.com/danmar/cppcheck
This commit is contained in:
commit
b16a480dfe
|
@ -85,7 +85,6 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- void assert(int expression) -->
|
<!-- void assert(int expression) -->
|
||||||
<function name="assert">
|
<function name="assert">
|
||||||
<noreturn>true</noreturn>
|
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
|
@ -2733,14 +2732,12 @@
|
||||||
</function>
|
</function>
|
||||||
<!-- void (*signal(int sig, void (*func)(int)))(int); -->
|
<!-- void (*signal(int sig, void (*func)(int)))(int); -->
|
||||||
<function name="signal">
|
<function name="signal">
|
||||||
<noreturn>true</noreturn>
|
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- int raise(int sig); -->
|
<!-- int raise(int sig); -->
|
||||||
<function name="raise">
|
<function name="raise">
|
||||||
<noreturn>true</noreturn>
|
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
</arg>
|
</arg>
|
||||||
|
|
|
@ -2156,6 +2156,9 @@ void CheckOther::checkSignOfUnsignedVariable()
|
||||||
const Scope * scope = symbolDatabase->functionScopes[i];
|
const Scope * scope = symbolDatabase->functionScopes[i];
|
||||||
// check all the code in the function
|
// check all the code in the function
|
||||||
for (const Token *tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
for (const Token *tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||||
|
// Quick check to see if any of the matches below have any chances
|
||||||
|
if (!tok->varId() && tok->str() != "0")
|
||||||
|
continue;
|
||||||
if (Token::Match(tok, "%name% <|<= 0") && tok->varId() && !Token::Match(tok->tokAt(3), "+|-")) {
|
if (Token::Match(tok, "%name% <|<= 0") && tok->varId() && !Token::Match(tok->tokAt(3), "+|-")) {
|
||||||
// TODO: handle a[10].b , a::b , (unsigned int)x , etc
|
// TODO: handle a[10].b , a::b , (unsigned int)x , etc
|
||||||
const Token *prev = tok->previous();
|
const Token *prev = tok->previous();
|
||||||
|
|
|
@ -302,14 +302,7 @@ void ErrorLogger::ErrorMessage::findAndReplace(std::string &source, const std::s
|
||||||
std::string::size_type index = 0;
|
std::string::size_type index = 0;
|
||||||
while ((index = source.find(searchFor, index)) != std::string::npos) {
|
while ((index = source.find(searchFor, index)) != std::string::npos) {
|
||||||
source.replace(index, searchFor.length(), replaceWith);
|
source.replace(index, searchFor.length(), replaceWith);
|
||||||
|
index += replaceWith.length();
|
||||||
std::string::size_type advanceBy;
|
|
||||||
if (searchFor.length() >= replaceWith.length())
|
|
||||||
advanceBy = replaceWith.length();
|
|
||||||
else
|
|
||||||
advanceBy = (replaceWith.length() - searchFor.length()) + 1;
|
|
||||||
|
|
||||||
index += advanceBy;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue