Fixed #882 (false positive: uninitialized variable)
This commit is contained in:
parent
4abbe9ffd4
commit
169bcfcff2
|
@ -553,11 +553,17 @@ void Preprocessor::removeAsm(std::string &str)
|
|||
{
|
||||
std::string::size_type pos = 0;
|
||||
while ((pos = str.find("\nasm(", pos)) != std::string::npos)
|
||||
_removeAsm(str, pos);
|
||||
{
|
||||
_removeAsm(str, pos++);
|
||||
str.insert(pos, "asm()");
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
while ((pos = str.find("\nasm (", pos)) != std::string::npos)
|
||||
_removeAsm(str, pos);
|
||||
{
|
||||
_removeAsm(str, pos++);
|
||||
str.insert(pos, "asm()");
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
while ((pos = str.find("\nasm __volatile(", pos)) != std::string::npos)
|
||||
|
|
|
@ -981,6 +981,14 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("int a()\n"
|
||||
"{\n"
|
||||
" int ret;\n"
|
||||
" asm();\n"
|
||||
" return ret;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// if..
|
||||
checkUninitVar("static void foo()\n"
|
||||
"{\n"
|
||||
|
|
|
@ -832,7 +832,7 @@ private:
|
|||
{
|
||||
std::string str1("\nasm(\n\n\n);");
|
||||
Preprocessor::removeAsm(str1);
|
||||
ASSERT_EQUALS("\n\n\n\n;", str1);
|
||||
ASSERT_EQUALS("\nasm()\n\n\n;", str1);
|
||||
|
||||
std::string str2("\nasm __volatile(\"\nlw iScale, 0x00(pScale)\n\", ());");
|
||||
Preprocessor::removeAsm(str2);
|
||||
|
|
Loading…
Reference in New Issue