Fixed parsing of "__asm__ volatile {""};"

This commit is contained in:
PKEuS 2012-11-04 12:21:34 +01:00
parent b0c1c2c819
commit 4cd96158ae
2 changed files with 3 additions and 1 deletions

View File

@ -458,7 +458,8 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
code << str[i++]; code << str[i++];
} }
code << '}'; code << '}';
} } else
--i;
} else if (ch == '#' && previous == '\n') { } else if (ch == '#' && previous == '\n') {
code << ch; code << ch;
previous = ch; previous = ch;

View File

@ -383,6 +383,7 @@ private:
ASSERT_EQUALS(" __asm123", preprocessor.removeComments(" __asm123", "3837.cpp")); ASSERT_EQUALS(" __asm123", preprocessor.removeComments(" __asm123", "3837.cpp"));
ASSERT_EQUALS("\" __asm { ; } \"", preprocessor.removeComments("\" __asm { ; } \"", "3837.cpp")); ASSERT_EQUALS("\" __asm { ; } \"", preprocessor.removeComments("\" __asm { ; } \"", "3837.cpp"));
ASSERT_EQUALS("__asm__ volatile { \"\" }", preprocessor.removeComments("__asm__ volatile { \"\" }", "3837.cpp"));
} }