Skip to content

Commit 341e485

Browse files
committed
fixed #578 - removed support for #file and #endfile [skip ci]
1 parent e61acf8 commit 341e485

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
@@ -783,21 +783,10 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
783783
if (!llTok->next)
784784
continue;
785785
if (llNextToken->next) {
786-
// #file "file.c"
787-
if (llNextToken->str() == "file" &&
788-
llNextToken->next->str()[0] == '\"')
789-
{
790-
const Token *strtok = cback();
791-
while (strtok->comment)
792-
strtok = strtok->previous;
793-
loc.push(location);
794-
location.fileIndex = fileIndex(strtok->str().substr(1U, strtok->str().size() - 2U));
795-
location.line = 1U;
796-
}
797786
// TODO: add support for "# 3"
798787
// #3 "file.c"
799788
// #line 3 "file.c"
800-
else if ((llNextToken->number &&
789+
if ((llNextToken->number &&
801790
llNextToken->next->str()[0] == '\"') ||
802791
(llNextToken->str() == "line" &&
803792
llNextToken->next->number &&
@@ -823,12 +812,6 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
823812
lineDirective(location.fileIndex, std::atol(numtok->str().c_str()), &location);
824813
}
825814
}
826-
// #endfile
827-
else if (llNextToken->str() == "endfile" && !loc.empty())
828-
{
829-
location = loc.top();
830-
loc.pop();
831-
}
832815
}
833816

834817
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)