handle #if (0) after removing parentheses
This commit is contained in:
parent
31c56d7353
commit
a331516735
|
@ -183,15 +183,15 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename,
|
||||||
// Clean up all preprocessor statements
|
// Clean up all preprocessor statements
|
||||||
result = preprocessCleanupDirectives(result);
|
result = preprocessCleanupDirectives(result);
|
||||||
|
|
||||||
// Remove '#if 0' blocks
|
|
||||||
if (result.find("#if 0\n") != std::string::npos)
|
|
||||||
result = removeIf0(result);
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Clean up preprocessor #if statements with Parantheses
|
// Clean up preprocessor #if statements with Parantheses
|
||||||
result = removeParantheses(result);
|
result = removeParantheses(result);
|
||||||
|
|
||||||
|
// Remove '#if 0' blocks
|
||||||
|
if (result.find("#if 0\n") != std::string::npos)
|
||||||
|
result = removeIf0(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -654,6 +654,12 @@ private:
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
"B\n");
|
"B\n");
|
||||||
ASSERT_EQUALS("\n\n\nB\n", preprocessor.read(code,"",NULL));
|
ASSERT_EQUALS("\n\n\nB\n", preprocessor.read(code,"",NULL));
|
||||||
|
|
||||||
|
std::istringstream code2("#if (0)\n"
|
||||||
|
"A\n"
|
||||||
|
"#endif\n"
|
||||||
|
"B\n");
|
||||||
|
ASSERT_EQUALS("\n\n\nB\n", preprocessor.read(code2,"",NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void if0_whitespace()
|
void if0_whitespace()
|
||||||
|
|
Loading…
Reference in New Issue