Skip to content

Commit 06b4e10

Browse files
committed
fixed #578 - removed support for #file and #endfile
1 parent 7a81c1a commit 06b4e10

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

simplecpp.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -704,21 +704,10 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
704704
if (!llTok->next)
705705
continue;
706706
if (llNextToken->next) {
707-
// #file "file.c"
708-
if (llNextToken->str() == "file" &&
709-
llNextToken->next->str()[0] == '\"')
710-
{
711-
const Token *strtok = cback();
712-
while (strtok->comment)
713-
strtok = strtok->previous;
714-
loc.push(location);
715-
location.fileIndex = fileIndex(strtok->str().substr(1U, strtok->str().size() - 2U));
716-
location.line = 1U;
717-
}
718707
// TODO: add support for "# 3"
719708
// #3 "file.c"
720709
// #line 3 "file.c"
721-
else if ((llNextToken->number &&
710+
if ((llNextToken->number &&
722711
llNextToken->next->str()[0] == '\"') ||
723712
(llNextToken->str() == "line" &&
724713
llNextToken->next->number &&
@@ -744,12 +733,6 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
744733
lineDirective(location.fileIndex, std::atol(numtok->str().c_str()), &location);
745734
}
746735
}
747-
// #endfile
748-
else if (llNextToken->str() == "endfile" && !loc.empty())
749-
{
750-
location = loc.top();
751-
loc.pop();
752-
}
753736
}
754737

755738
continue;

test.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,8 +2130,6 @@ static void location11()
21302130
preprocess(code));
21312131
}
21322132

2133-
// TODO: test #file/#endfile
2134-
21352133
static void missingHeader1()
21362134
{
21372135
const char code[] = "#include \"notexist.h\"\n";

0 commit comments

Comments
 (0)