Preprocessor: Cleanup unused functions

This commit is contained in:
Daniel Marjamäki 2016-07-25 14:29:02 +02:00
parent 8c8ad96fe5
commit 90faa80590
3 changed files with 0 additions and 84 deletions

View File

@ -643,35 +643,6 @@ void Preprocessor::error(const std::string &filename, unsigned int linenr, const
false));
}
Preprocessor::HeaderTypes Preprocessor::getHeaderFileName(std::string &str)
{
std::string::size_type i = str.find_first_of("<\"");
if (i == std::string::npos) {
str = "";
return NoHeader;
}
char c = str[i];
if (c == '<')
c = '>';
std::string result;
for (i = i + 1; i < str.length(); ++i) {
if (str[i] == c)
break;
result.append(1, str[i]);
}
// Linux can't open include paths with \ separator, so fix them
std::replace(result.begin(), result.end(), '\\', '/');
str = result;
return (c == '\"') ? UserHeader : SystemHeader;
}
// Report that include is missing
void Preprocessor::missingInclude(const std::string &filename, unsigned int linenr, const std::string &header, HeaderTypes headerType)
{

View File

@ -164,22 +164,6 @@ public:
*/
static void writeError(const std::string &fileName, const unsigned int linenr, ErrorLogger *errorLogger, const std::string &errorType, const std::string &errorText);
/**
* Remove redundant parentheses from preprocessor commands. This should only be called from read().
* @param str Code processed by read().
* @return code with reduced parentheses
*/
static std::string removeParentheses(const std::string &str);
/**
* Returns the string between double quote characters or \< \> characters.
* @param str e.g. \code#include "menu.h"\endcode or \code#include <menu.h>\endcode
* After function call it will contain e.g. "menu.h" without double quotes.
* @return NoHeader empty string if double quotes or \< \> were not found.
* UserHeader if file surrounded with "" was found
* SystemHeader if file surrounded with \<\> was found
*/
static Preprocessor::HeaderTypes getHeaderFileName(std::string &str);
private:
/**
@ -190,8 +174,6 @@ private:
*/
static std::string removeSpaceNearNL(const std::string &str);
static std::string getdef(std::string line, bool def);
public:

View File

@ -71,10 +71,6 @@ public:
return tokens2.stringify();
}
static int getHeaderFileName(std::string &str) {
return Preprocessor::getHeaderFileName(str);
}
};
private:
@ -197,7 +193,6 @@ private:
TEST_CASE(conditionalDefine);
TEST_CASE(macro_parameters);
TEST_CASE(newline_in_macro);
TEST_CASE(includes);
TEST_CASE(ifdef_ifdefined);
// define and then ifdef
@ -2001,38 +1996,6 @@ private:
ASSERT_EQUALS("", errout.str());
}
void includes() const {
{
std::string src = "#include a.h";
ASSERT_EQUALS(OurPreprocessor::NoHeader, OurPreprocessor::getHeaderFileName(src));
ASSERT_EQUALS("", src);
}
{
std::string src = "#include \"b.h\"";
ASSERT_EQUALS(OurPreprocessor::UserHeader, OurPreprocessor::getHeaderFileName(src));
ASSERT_EQUALS("b.h", src);
}
{
std::string src = "#include <c.h>";
ASSERT_EQUALS(OurPreprocessor::SystemHeader, OurPreprocessor::getHeaderFileName(src));
ASSERT_EQUALS("c.h", src);
}
{
std::string src = "#include \"d/d.h\"";
ASSERT_EQUALS(OurPreprocessor::UserHeader, OurPreprocessor::getHeaderFileName(src));
ASSERT_EQUALS("d/d.h", src);
}
{
std::string src = "#include \"e\\e.h\"";
ASSERT_EQUALS(OurPreprocessor::UserHeader, OurPreprocessor::getHeaderFileName(src));
ASSERT_EQUALS("e/e.h", src);
}
}
void ifdef_ifdefined() {
const char filedata[] = "#ifdef ABC\n"
"A\n"