From f188ea33c6cd1ff25ab2b42e84b2fbca6c7bcfe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 17 Apr 2018 08:12:15 +0200 Subject: [PATCH] bump simplecpp --- externals/simplecpp/simplecpp.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/externals/simplecpp/simplecpp.cpp b/externals/simplecpp/simplecpp.cpp index 3e769a5c9..969a23c9b 100644 --- a/externals/simplecpp/simplecpp.cpp +++ b/externals/simplecpp/simplecpp.cpp @@ -1179,6 +1179,8 @@ namespace simplecpp { ++par; else if (rawtok->op == ')') --par; + else if (rawtok->op == '#' && !sameline(rawtok->previous, rawtok)) + throw Error(rawtok->location, "it is invalid to use a preprocessor directive as macro parameter"); rawtokens2.push_back(new Token(rawtok->str, rawtok1->location)); rawtok = rawtok->next; } @@ -2313,10 +2315,13 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL } if (rawtok->op == '#' && !sameline(rawtok->previous, rawtok)) { + if (!sameline(rawtok, rawtok->next)) { + rawtok = rawtok->next; + continue; + } rawtok = rawtok->next; - if (!rawtok || !rawtok->name) { - if (rawtok) - rawtok = gotoNextLine(rawtok); + if (!rawtok->name) { + rawtok = gotoNextLine(rawtok); continue; }