From 894a74eed9f8d23594313f8e097f2672fe91aac1 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Thu, 3 Sep 2015 18:10:40 +1000 Subject: [PATCH] Check parsed config on unknown functions --- src/init.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ src/init.h | 1 + src/main.cpp | 4 ++++ 3 files changed, 47 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 2b2573b..5b418de 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -54,6 +54,48 @@ int BuildDepTree(DepTree* deptree,std::set& used) return deptree->CreateGlobalTree(used); } + +int CheckFunctions() +{ + std::set funcs; + + for(auto& i:G_tosave) + { + i->UsedFuncs(funcs); + for(auto& f:funcs) if(G_funcs.find(f)==G_funcs.end()) + { + COUT(ERROR)<<"Unknown function "<Dump()<UsedFuncs(funcs); + for(auto& f:funcs) if(G_funcs.find(f)==G_funcs.end()) + { + COUT(ERROR)<<"Unknown function "<Dump()<UsedFuncs(funcs); + for(auto& f:funcs) if(G_funcs.find(f)==G_funcs.end()) + { + COUT(ERROR)<<"Unknown function "<& used); +int CheckFunctions(); void DumpConfig(); #endif diff --git a/src/main.cpp b/src/main.cpp index 43b1283..bdd1f07 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,6 +37,10 @@ int main(int argc, char** argv) RegisterArifmeticFunctions(); + COUT(INFO)<<"Checking functions "; + ret=CheckFunctions(); if(ret!=0) { ClearGlobals(); delete DPTree; return 1;} + COUT(INFO)<<"Ok"<