]> git.tdb.fi Git - builder.git/commitdiff
Further tweak GnuCompiler::query_version
authorMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 20:40:20 +0000 (22:40 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 20:40:20 +0000 (22:40 +0200)
Some compilers return non-numeric version components, like 4.9.x.  This
change keeps values of all the initial numeric components.

source/gnucompiler.cpp

index 4ee09ed5d97593c74c1130d509337ddec39b2ad0..59ffdf2fff4e0f65f80c440e650931df25e8dc3f 100644 (file)
@@ -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<string> version_parts = split(version_str, '.');
-               unsigned ver = 0;
                for(unsigned i=0; (i<3 && i<version_parts.size()); ++i)
                        ver |= lexical_cast<unsigned>(version_parts[i])<<(16-8*i);
-               return ver;
        }
        catch(const runtime_error &)
        { }
 
-       return 0;
+       return ver;
 }
 
 Task *GnuCompiler::_run(const ObjectFile &object)