Preprocessor: better handling of pragma asm and pragma endasm
This commit is contained in:
parent
7c86a10a9d
commit
ff9ed1d7aa
|
@ -905,14 +905,14 @@ std::string Preprocessor::getcode(const std::string &filedata, std::string cfg,
|
|||
std::string line;
|
||||
while (getline(istr, line))
|
||||
{
|
||||
if (line == "#pragma asm")
|
||||
if (line.substr(0, 11) == "#pragma asm")
|
||||
{
|
||||
ret << "\n";
|
||||
bool found_end = false;
|
||||
while (getline(istr, line))
|
||||
{
|
||||
ret << "\n";
|
||||
if (line == "#pragma endasm")
|
||||
if (line.substr(0, 14) == "#pragma endasm")
|
||||
{
|
||||
found_end = true;
|
||||
break;
|
||||
|
|
|
@ -1101,7 +1101,11 @@ private:
|
|||
const char filedata[] = "#pragma asm\n"
|
||||
" mov r1, 11\n"
|
||||
"#pragma endasm\n"
|
||||
"aaa";
|
||||
"aaa\n"
|
||||
"#pragma asm foo\n"
|
||||
" mov r1, 11\n"
|
||||
"#pragma endasm bar\n"
|
||||
"bbb";
|
||||
|
||||
// Preprocess => actual result..
|
||||
std::istringstream istr(filedata);
|
||||
|
@ -1111,7 +1115,7 @@ private:
|
|||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS(1, static_cast<unsigned int>(actual.size()));
|
||||
ASSERT_EQUALS("\n\n\naaa\n", actual[""]);
|
||||
ASSERT_EQUALS("\n\n\naaa\n\n\n\nbbb\n", actual[""]);
|
||||
}
|
||||
|
||||
void endifsemicolon()
|
||||
|
|
Loading…
Reference in New Issue