diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index c41134a09..f7fdcde6e 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -183,15 +183,15 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename, // Clean up all preprocessor statements 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 result = removeParantheses(result); + // Remove '#if 0' blocks + if (result.find("#if 0\n") != std::string::npos) + result = removeIf0(result); + return result; } diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 1e6ce5c64..2e3721914 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -654,6 +654,12 @@ private: "#endif\n" "B\n"); 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()