diff --git a/preprocessor.cpp b/preprocessor.cpp index a3b02fc8d..add5462af 100644 --- a/preprocessor.cpp +++ b/preprocessor.cpp @@ -159,13 +159,8 @@ void preprocess(std::istream &istr, std::map &result) // Get the DEF in this line: "#ifdef DEF" static std::string getdef(std::string line, bool def) { - if ( def && line.find("#if 0") == 0 ) - return "0"; - if ( def && line.find("#if 1") == 0 ) - return "1"; - // If def is true, the line must start with "#ifdef" - if ( def && line.find("#ifdef ") != 0 ) + if ( def && line.find("#ifdef ") != 0 && line.find("#if ") != 0 ) { return ""; } diff --git a/testpreprocessor.cpp b/testpreprocessor.cpp index f5e8ea19c..2b335543d 100644 --- a/testpreprocessor.cpp +++ b/testpreprocessor.cpp @@ -285,7 +285,6 @@ private: void if_cond1() { - /* TODO: Make this work const char filedata[] = "#if LIBVER>100\n" " A\n" "#else\n" @@ -293,7 +292,8 @@ private: "#endif\n"; std::map expected; - expected[""] = filedata; + expected[""] = "\n\n\nB\n\n"; + expected["LIBVER>100"] = "\nA\n\n\n\n"; // Preprocess => actual result.. std::istringstream istr(filedata); @@ -302,7 +302,6 @@ private: // Compare results.. ASSERT_EQUALS( true, cmpmaps(actual, expected)); - */ } };