bumped simplecpp

This commit is contained in:
Daniel Marjamäki 2019-07-03 17:03:46 +02:00
parent 60a213e6a5
commit 88dfb1968f
1 changed files with 26 additions and 23 deletions

View File

@ -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<std::string> &files, std::map<std::string, simplecpp::TokenList *> &filedata, const simplecpp::DUI &dui, simplecpp::OutputList *outputList, std::list<simplecpp::MacroUsage> *macroUsage)
{
std::map<std::string, std::size_t> sizeOfType(rawtokens.sizeOfType);
sizeOfType.insert(std::pair<std::string, std::size_t>("char", sizeof(char)));
sizeOfType.insert(std::pair<std::string, std::size_t>("short", sizeof(short)));
sizeOfType.insert(std::pair<std::string, std::size_t>("short int", sizeOfType["short"]));
sizeOfType.insert(std::pair<std::string, std::size_t>("int", sizeof(int)));
sizeOfType.insert(std::pair<std::string, std::size_t>("long", sizeof(long)));
sizeOfType.insert(std::pair<std::string, std::size_t>("long int", sizeOfType["long"]));
sizeOfType.insert(std::pair<std::string, std::size_t>("long long", sizeof(long long)));
sizeOfType.insert(std::pair<std::string, std::size_t>("float", sizeof(float)));
sizeOfType.insert(std::pair<std::string, std::size_t>("double", sizeof(double)));
sizeOfType.insert(std::pair<std::string, std::size_t>("long double", sizeof(long double)));
sizeOfType.insert(std::pair<std::string, std::size_t>("char *", sizeof(char *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("short *", sizeof(short *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("short int *", sizeOfType["short *"]));
sizeOfType.insert(std::pair<std::string, std::size_t>("int *", sizeof(int *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("long *", sizeof(long *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("long int *", sizeOfType["long *"]));
sizeOfType.insert(std::pair<std::string, std::size_t>("long long *", sizeof(long long *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("float *", sizeof(float *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("double *", sizeof(double *)));
sizeOfType.insert(std::pair<std::string, std::size_t>("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<TokenString, Macro> macros;
for (std::list<std::string>::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<TokenString,Macro>(macro.name(), macro));
}
macros.insert(std::pair<TokenString,Macro>("__FILE__", Macro("__FILE__", "__FILE__", files)));
macros.insert(std::pair<TokenString,Macro>("__LINE__", Macro("__LINE__", "__LINE__", files)));
macros.insert(std::pair<TokenString,Macro>("__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);