Fixed #1504 (False positive: Cppcheck incorrectly reports that extern variable is not initialized)
This commit is contained in:
parent
3d90559035
commit
5b1b845750
|
@ -4333,6 +4333,12 @@ void Tokenizer::unsignedint()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Token::Match(tok->previous(), "extern unsigned|signed *| %var% [;[]"))
|
||||
{
|
||||
tok->str("int");
|
||||
continue;
|
||||
}
|
||||
|
||||
// signed int a; -> int a;
|
||||
if (Token::Match(tok, "signed %type% %var% [;,=)]"))
|
||||
{
|
||||
|
|
|
@ -2734,6 +2734,12 @@ private:
|
|||
ASSERT_EQUALS(code2, tokenizeAndStringify(code1));
|
||||
}
|
||||
|
||||
// "extern unsigned x;" => "extern int x;"
|
||||
{
|
||||
const char code1[] = "; extern unsigned x;";
|
||||
const char code2[] = "; extern int x ;";
|
||||
ASSERT_EQUALS(code2, tokenizeAndStringify(code1));
|
||||
}
|
||||
}
|
||||
|
||||
void unsigned2()
|
||||
|
|
Loading…
Reference in New Issue