From 88dfb1968f7a4bedc2ae69404a096e1d71d92707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 3 Jul 2019 17:03:46 +0200 Subject: [PATCH] bumped simplecpp --- externals/simplecpp/simplecpp.cpp | 49 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/externals/simplecpp/simplecpp.cpp b/externals/simplecpp/simplecpp.cpp index 51dfbc69c..2493a0a0b 100644 --- a/externals/simplecpp/simplecpp.cpp +++ b/externals/simplecpp/simplecpp.cpp @@ -2484,26 +2484,26 @@ static bool preprocessToken(simplecpp::TokenList &output, const simplecpp::Token void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenList &rawtokens, std::vector &files, std::map &filedata, const simplecpp::DUI &dui, simplecpp::OutputList *outputList, std::list *macroUsage) { std::map sizeOfType(rawtokens.sizeOfType); - sizeOfType.insert(std::pair("char", sizeof(char))); - sizeOfType.insert(std::pair("short", sizeof(short))); - sizeOfType.insert(std::pair("short int", sizeOfType["short"])); - sizeOfType.insert(std::pair("int", sizeof(int))); - sizeOfType.insert(std::pair("long", sizeof(long))); - sizeOfType.insert(std::pair("long int", sizeOfType["long"])); - sizeOfType.insert(std::pair("long long", sizeof(long long))); - sizeOfType.insert(std::pair("float", sizeof(float))); - sizeOfType.insert(std::pair("double", sizeof(double))); - sizeOfType.insert(std::pair("long double", sizeof(long double))); - sizeOfType.insert(std::pair("char *", sizeof(char *))); - sizeOfType.insert(std::pair("short *", sizeof(short *))); - sizeOfType.insert(std::pair("short int *", sizeOfType["short *"])); - sizeOfType.insert(std::pair("int *", sizeof(int *))); - sizeOfType.insert(std::pair("long *", sizeof(long *))); - sizeOfType.insert(std::pair("long int *", sizeOfType["long *"])); - sizeOfType.insert(std::pair("long long *", sizeof(long long *))); - sizeOfType.insert(std::pair("float *", sizeof(float *))); - sizeOfType.insert(std::pair("double *", sizeof(double *))); - sizeOfType.insert(std::pair("long double *", sizeof(long double *))); + sizeOfType.insert(std::make_pair("char", sizeof(char))); + sizeOfType.insert(std::make_pair("short", sizeof(short))); + sizeOfType.insert(std::make_pair("short int", sizeOfType["short"])); + sizeOfType.insert(std::make_pair("int", sizeof(int))); + sizeOfType.insert(std::make_pair("long", sizeof(long))); + sizeOfType.insert(std::make_pair("long int", sizeOfType["long"])); + sizeOfType.insert(std::make_pair("long long", sizeof(long long))); + sizeOfType.insert(std::make_pair("float", sizeof(float))); + sizeOfType.insert(std::make_pair("double", sizeof(double))); + sizeOfType.insert(std::make_pair("long double", sizeof(long double))); + sizeOfType.insert(std::make_pair("char *", sizeof(char *))); + sizeOfType.insert(std::make_pair("short *", sizeof(short *))); + sizeOfType.insert(std::make_pair("short int *", sizeOfType["short *"])); + sizeOfType.insert(std::make_pair("int *", sizeof(int *))); + sizeOfType.insert(std::make_pair("long *", sizeof(long *))); + sizeOfType.insert(std::make_pair("long int *", sizeOfType["long *"])); + sizeOfType.insert(std::make_pair("long long *", sizeof(long long *))); + sizeOfType.insert(std::make_pair("float *", sizeof(float *))); + sizeOfType.insert(std::make_pair("double *", sizeof(double *))); + sizeOfType.insert(std::make_pair("long double *", sizeof(long double *))); std::map macros; for (std::list::const_iterator it = dui.defines.begin(); it != dui.defines.end(); ++it) { @@ -2519,9 +2519,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL macros.insert(std::pair(macro.name(), macro)); } - macros.insert(std::pair("__FILE__", Macro("__FILE__", "__FILE__", files))); - macros.insert(std::pair("__LINE__", Macro("__LINE__", "__LINE__", files))); - macros.insert(std::pair("__COUNTER__", Macro("__COUNTER__", "__COUNTER__", files))); + macros.insert(std::make_pair("__FILE__", Macro("__FILE__", "__FILE__", files))); + macros.insert(std::make_pair("__LINE__", Macro("__LINE__", "__LINE__", files))); + macros.insert(std::make_pair("__COUNTER__", Macro("__COUNTER__", "__COUNTER__", files))); // TRUE => code in current #if block should be kept // ELSE_IS_TRUE => code in current #if block should be dropped. the code in the #else should be kept. @@ -2750,6 +2750,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL output.clear(); return; } + if (!tmp) + break; + tok = tmp->previous; } try { conditionIsTrue = (evaluate(expr, sizeOfType) != 0);