Skip to content

Commit 57f9a3b

Browse files
committed
fixed #578 - removed support for #file and #endfile [skip ci]
1 parent 4925827 commit 57f9a3b

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
@@ -706,21 +706,10 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
706706
if (!llTok->next)
707707
continue;
708708
if (llNextToken->next) {
709-
// #file "file.c"
710-
if (llNextToken->str() == "file" &&
711-
llNextToken->next->str()[0] == '\"')
712-
{
713-
const Token *strtok = cback();
714-
while (strtok->comment)
715-
strtok = strtok->previous;
716-
loc.push(location);
717-
location.fileIndex = fileIndex(strtok->str().substr(1U, strtok->str().size() - 2U));
718-
location.line = 1U;
719-
}
720709
// TODO: add support for "# 3"
721710
// #3 "file.c"
722711
// #line 3 "file.c"
723-
else if ((llNextToken->number &&
712+
if ((llNextToken->number &&
724713
llNextToken->next->str()[0] == '\"') ||
725714
(llNextToken->str() == "line" &&
726715
llNextToken->next->number &&
@@ -746,12 +735,6 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
746735
lineDirective(location.fileIndex, std::atol(numtok->str().c_str()), &location);
747736
}
748737
}
749-
// #endfile
750-
else if (llNextToken->str() == "endfile" && !loc.empty())
751-
{
752-
location = loc.top();
753-
loc.pop();
754-
}
755738
}
756739

757740
continue;

test.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,8 +2138,6 @@ static void location11()
21382138
preprocess(code));
21392139
}
21402140

2141-
// TODO: test #file/#endfile
2142-
21432141
static void missingHeader1()
21442142
{
21452143
const char code[] = "#include \"notexist.h\"\n";

0 commit comments

Comments
 (0)