diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 459121265..7182cf832 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -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) diff --git a/test/testother.cpp b/test/testother.cpp index 52e61599e..e16ef4dd5 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -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" diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 9721912e5..c2c687d57 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -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);