From: Mikko Rasa Date: Mon, 26 Dec 2022 20:40:20 +0000 (+0200) Subject: Further tweak GnuCompiler::query_version X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=68c59c6280c37222348e83c4f57de6116513d8fe;hp=354bb72645fed7f560d909bd6487933526cba036;p=builder.git Further tweak GnuCompiler::query_version Some compilers return non-numeric version components, like 4.9.x. This change keeps values of all the initial numeric components. --- diff --git a/source/gnucompiler.cpp b/source/gnucompiler.cpp index 4ee09ed..59ffdf2 100644 --- a/source/gnucompiler.cpp +++ b/source/gnucompiler.cpp @@ -195,20 +195,19 @@ unsigned GnuCompiler::query_version(const string &exe_path, const string &arg) c argv.push_back(arg); builder.get_logger().log("auxcommands", "Running %s", join(argv.begin(), argv.end())); + unsigned ver = 0; try { string version_str = strip(ExternalTask::run_and_capture_output(argv)); vector version_parts = split(version_str, '.'); - unsigned ver = 0; for(unsigned i=0; (i<3 && i(version_parts[i])<<(16-8*i); - return ver; } catch(const runtime_error &) { } - return 0; + return ver; } Task *GnuCompiler::_run(const ObjectFile &object)