From 468d4923e419f0fe035b4395c152e85cb5c3a3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 21 Aug 2017 18:43:42 +0200 Subject: [PATCH] bump simplecpp --- externals/simplecpp/simplecpp.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/externals/simplecpp/simplecpp.cpp b/externals/simplecpp/simplecpp.cpp index 22fac5089..9c147fa14 100644 --- a/externals/simplecpp/simplecpp.cpp +++ b/externals/simplecpp/simplecpp.cpp @@ -1847,16 +1847,20 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::mapnext; if (!tok1) { - throw std::runtime_error("missed sizeof argument"); + throw std::runtime_error("missing sizeof argument"); } simplecpp::Token *tok2 = tok1->next; if (!tok2) { - throw std::runtime_error("missed sizeof argument"); + throw std::runtime_error("missing sizeof argument"); } if (tok1->op == '(') { tok1 = tok1->next; - while (tok2->op != ')') + while (tok2->op != ')') { tok2 = tok2->next; + if (!tok2) { + throw std::runtime_error("invalid sizeof expression"); + } + } } std::string type; @@ -2353,12 +2357,14 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL } try { conditionIsTrue = (evaluate(expr, sizeOfType) != 0); - } catch (const std::exception &) { + } catch (const std::exception &e) { if (outputList) { Output out(rawtok->location.files); out.type = Output::SYNTAX_ERROR; out.location = rawtok->location; out.msg = "failed to evaluate " + std::string(rawtok->str == IF ? "#if" : "#elif") + " condition"; + if (e.what() && *e.what()) + out.msg += std::string(", ") + e.what(); outputList->push_back(out); } output.clear();