if(!executable)
return;
- prepare_version("-dumpversion");
+ string exe_path = executable->get_path().str();
+ version = query_version("-dumpversion");
if(version>=0x70000)
- prepare_version("-dumpfullversion");
+ version = query_version("-dumpfullversion");
builder.get_logger().log("tools", "%s version is %d.%d.%d", FS::basename(executable->get_path()), version>>16, (version>>8)&0xFF, version&0xFF);
}
-void GnuCompiler::prepare_version(const string &arg)
+unsigned GnuCompiler::query_version(const string &arg) const
{
ExternalTask::Arguments argv;
argv.push_back(executable->get_path().str());
string version_str = strip(ExternalTask::run_and_capture_output(argv));
vector<string> version_parts = split(version_str, '.');
- version = 0;
+ unsigned ver = 0;
for(unsigned i=0; (i<3 && i<version_parts.size()); ++i)
- version |= lexical_cast<unsigned>(version_parts[i])<<(16-8*i);
+ ver |= lexical_cast<unsigned>(version_parts[i])<<(16-8*i);
+ return ver;
}
catch(const runtime_error &)
{ }
+
+ return 0;
}
Task *GnuCompiler::_run(const ObjectFile &object)
void do_prepare() override;
void prepare_syspath();
void prepare_version();
- void prepare_version(const std::string &);
+ unsigned query_version(const std::string &) const;
private:
static Task *_run(const ObjectFile &);