[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Plan Plan-Batch.cpp, 1.4, 1.5 Plan-Batch.h, 1.
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-06-13 18:40:46
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1230 Modified Files: Plan-Batch.cpp Plan-Batch.h Log Message: Language compatibility checking before adding benchmarks or compilers. Index: Plan-Batch.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan-Batch.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Plan-Batch.h 30 May 2007 17:02:27 -0000 1.2 --- Plan-Batch.h 13 Jun 2007 18:40:43 -0000 1.3 *************** *** 52,55 **** --- 52,60 ---- virtual int isUnique(class Compiler *_compiler); + + /** languages */ + virtual int isLanguageCompatibleWithCompilers(std::string _lang); + virtual int isLanguageCompatibleWithBenchmarks(std::string _lang); + virtual int isUnique(CBM_OS *_set); virtual int isUnique(class Benchmark *_benchmark); Index: Plan-Batch.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan-Batch.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Plan-Batch.cpp 13 Jun 2007 18:11:37 -0000 1.4 --- Plan-Batch.cpp 13 Jun 2007 18:40:43 -0000 1.5 *************** *** 52,55 **** --- 52,99 ---- } + int PlanBatch::isLanguageCompatibleWithCompilers(std::string _lang) + { + int i; + int n = compilerNumber(); + CBM::Compiler *C; + std::string l; + + for(i=0; i<n; i++) { + C=getCompiler(i); + if (C->Language() != _lang) { + l=_lang; + l+=" language is incompatible with "; + l+=C->Language(); + l+=" defined by "; + l+=C->Name(); + cbmUI->outputInfo(l); + return(0); + } + } + return(1); + } + + int PlanBatch::isLanguageCompatibleWithBenchmarks(std::string _lang) + { + int i; + int n = benchmarkNumber(); + CBM::Benchmark *B; + std::string l; + + for(i=0; i<n; i++) { + B=getBenchmark(i); + if (B->Package()->language() != _lang) { + l=_lang; + l+=" language is incompatible with "; + l+=B->Package()->language(); + l+=" defined by "; + l+=B->Name(); + cbmUI->outputInfo(l); + return(0); + } + } + return(1); + } + int PlanBatch::isUnique(CBM::CompilerOptionSet *_set) { *************** *** 151,155 **** if (!_compiler) { ! cbmUI->outputKO("Not a supported compiler"); return(0); } --- 195,206 ---- if (!_compiler) { ! cbmUI->outputInfo("Not a supported compiler"); ! cbmUI->outputKO(); ! return(0); ! } ! ! if ((!isLanguageCompatibleWithCompilers(_compiler->Language())) || ! (!isLanguageCompatibleWithBenchmarks(_compiler->Language()))) { ! cbmUI->outputKO(); return(0); } *************** *** 212,215 **** --- 263,273 ---- return(0); } + + if ((!isLanguageCompatibleWithCompilers(_benchmark->Package()->language())) || + (!isLanguageCompatibleWithBenchmarks(_benchmark->Package()->language()))) { + cbmUI->outputKO(); + return(0); + } + if (_benchmark->Package()->getStatus()<CBM::Package::Preconfigured) { cbmUI->outputInfo("Benchmark not configured. Please finish its installation"); |