Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,11 +1072,19 @@ void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList &tokenList)
break;
}

const simplecpp::Token * const tok4 = tok3->next;
tok->setstr("asm");
const_cast<simplecpp::Token *>(tok2)->setstr("(");
const_cast<simplecpp::Token *>(tok3)->setstr(")");
const_cast<simplecpp::Token *>(tok4)->setstr(";");

simplecpp::Token * tok4;
if (tok3->next) {
tok4 = tok3->next;
tok4->setstr(";");
} else {
tok4 = new simplecpp::Token(";", tok3->location);
const_cast<simplecpp::Token *>(tok3)->next = tok4;
}

while (tok4->next != endasm)
tokenList.deleteToken(tok4->next);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#pragma asm
8 changes: 8 additions & 0 deletions test/testpreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ class TestPreprocessor : public TestFixture {
TEST_CASE(standard);

TEST_CASE(writeLocations);

TEST_CASE(pragmaAsm);
}

template<size_t size>
Expand Down Expand Up @@ -2773,6 +2775,12 @@ class TestPreprocessor : public TestFixture {
"} ;",
processed);
}

void pragmaAsm()
{
const char code[] = "#pragma asm";
(void) getcodeforcfg(settingsDefault, *this, code, "", "test.cpp");
}
};

REGISTER_TEST(TestPreprocessor)
Loading