From 7616246597bfdfed99c3d8a33f5f37b2c43d8b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 26 Nov 2009 17:32:18 +0100 Subject: [PATCH] Fixed #1014 (Preprocessor: Invalid preprocessing of '#define some_delete(x) delete x;') --- lib/preprocessor.cpp | 2 +- test/testpreprocessor.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 9d102bd44..c5ac76e2f 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1703,7 +1703,7 @@ public: } optcomma = false; macrocode += str; - if (Token::Match(tok, "%type% %var%")) + if (Token::Match(tok, "%var% %var%")) macrocode += " "; } } diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 11ed8bff0..3f630cbe2 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -123,6 +123,7 @@ private: TEST_CASE(macro_simple8); TEST_CASE(macro_simple9); TEST_CASE(macro_simple10); + TEST_CASE(macro_simple11); TEST_CASE(macroInMacro); TEST_CASE(macro_mismatch); TEST_CASE(macro_linenumbers); @@ -1012,6 +1013,13 @@ private: ASSERT_EQUALS("\nunsigned long x;", OurPreprocessor::expandMacros(filedata)); } + void macro_simple11() + { + const char filedata[] = "#define ABC(x) delete x\n" + "ABC(a);"; + ASSERT_EQUALS("\ndelete a;", OurPreprocessor::expandMacros(filedata)); + } + void macroInMacro() { {