diff --git a/simplecpp.cpp b/simplecpp.cpp index 599ffdf..70364f7 100755 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -2832,6 +2832,8 @@ static void simplifyName(simplecpp::TokenList &expr) if (alt) continue; } + if (tok->next && tok->next->str() == "(") + throw std::runtime_error("undefined function-like macro invocation: " + tok->str() + "( ... )"); tok->setstr("0"); } } diff --git a/test.cpp b/test.cpp index cec253b..18ca8af 100644 --- a/test.cpp +++ b/test.cpp @@ -1825,6 +1825,15 @@ static void ifexpr() ASSERT_EQUALS("\n\n1", preprocess(code)); } +static void ifUndefFuncStyleMacro() +{ + const char code[] = "#if A(