diff --git a/src/tokenize.cpp b/src/tokenize.cpp index 623c678c9..735745670 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -2670,6 +2670,11 @@ const Token * Tokenizer::FindClassFunction(const Token *tok, const char classnam void Tokenizer::syntaxError(const Token *tok, char c) { + if (_settings._debug) + { + _tokens->printOut(); + } + if (!_errorLogger) { std::cout << "### Unlogged error at Tokenizer::syntaxError" << std::endl; diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index b2303f10e..cfa7755b8 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -122,6 +122,7 @@ private: TEST_CASE(unicode1); TEST_CASE(define_part_of_func); + TEST_CASE(multiline_comment); } @@ -928,6 +929,27 @@ private: ASSERT_EQUALS("", errout.str()); } + void multiline_comment() + { + errout.str(""); + const char filedata[] = "#define ABC {// \\\n" + "}\n" + "void f() ABC }\n"; + + // Preprocess => actual result.. + std::istringstream istr(filedata); + std::map actual; + Preprocessor preprocessor; + preprocessor.preprocess(istr, actual, "file.c"); + + // Compare results.. + ASSERT_EQUALS(1, static_cast(actual.size())); + TODO_ASSERT_EQUALS("\n\nvoid f() { }\n", actual[""]); + ASSERT_EQUALS("", errout.str()); + } + + + }; REGISTER_TEST(TestPreprocessor)