diff --git a/simplecpp.cpp b/simplecpp.cpp index ef891eb1..4c610c1a 100644 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -654,8 +654,6 @@ static const std::string COMMENT_END("*/"); void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename, OutputList *outputList) { - std::stack loc; - unsigned int multiline = 0U; const Token *oldLastToken = nullptr; @@ -704,26 +702,15 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename, if (!llTok->next) continue; if (llNextToken->next) { - // #file "file.c" - if (llNextToken->str() == "file" && - llNextToken->next->str()[0] == '\"') - { - const Token *strtok = cback(); - while (strtok->comment) - strtok = strtok->previous; - loc.push(location); - location.fileIndex = fileIndex(strtok->str().substr(1U, strtok->str().size() - 2U)); - location.line = 1U; - } // TODO: add support for "# 3" // #3 "file.c" // #line 3 "file.c" - else if ((llNextToken->number && - llNextToken->next->str()[0] == '\"') || - (llNextToken->str() == "line" && - llNextToken->next->number && - llNextToken->next->next && - llNextToken->next->next->str()[0] == '\"')) + if ((llNextToken->number && + llNextToken->next->str()[0] == '\"') || + (llNextToken->str() == "line" && + llNextToken->next->number && + llNextToken->next->next && + llNextToken->next->next->str()[0] == '\"')) { const Token *strtok = cback(); while (strtok->comment) @@ -744,12 +731,6 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename, lineDirective(location.fileIndex, std::atol(numtok->str().c_str()), &location); } } - // #endfile - else if (llNextToken->str() == "endfile" && !loc.empty()) - { - location = loc.top(); - loc.pop(); - } } continue; diff --git a/test.cpp b/test.cpp index 69e08781..3842d3ef 100644 --- a/test.cpp +++ b/test.cpp @@ -2138,8 +2138,6 @@ static void location11() preprocess(code)); } -// TODO: test #file/#endfile - static void missingHeader1() { const char code[] = "#include \"notexist.h\"\n";