]> git.tdb.fi Git - builder.git/commitdiff
Reject architecture specification conflicts for all fields
authorMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 11:01:27 +0000 (13:01 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 11:34:51 +0000 (13:34 +0200)
This gives errors for nonsensical stuff like linux-windows-32-64-gnu-msvc,
which was previously accepted.

source/architecture.cpp

index 5f8aea0d853f37759cf725cd25a88801eab3e486..758d8b9b3a264d5f3905d9d18f10b033b7849e15 100644 (file)
@@ -302,6 +302,8 @@ void Architecture::parse_specification(const string &spec)
                for(unsigned j=0; (!ok && systems[j]); ++j)
                        if(p==systems[j])
                        {
+                               if(!system.empty() && p!=system)
+                                       throw invalid_argument("Conflicting system specification");
                                system = p;
                                ok = true;
                        }
@@ -309,13 +311,18 @@ void Architecture::parse_specification(const string &spec)
                for(unsigned j=0; (!ok && toolchains[j]); ++j)
                        if(p==toolchains[j])
                        {
+                               if(!toolchain.empty() && p!=toolchain)
+                                       throw invalid_argument("Conflicting toolchain specification");
                                toolchain = p;
                                ok = true;
                        }
 
                if(!ok && (p=="32" || p=="64"))
                {
-                       bits = lexical_cast<unsigned>(p);
+                       unsigned b = lexical_cast<unsigned>(p);
+                       if(bits && b!=bits)
+                               throw invalid_argument("Conflicting bits specification");
+                       bits = b;
                        ok = true;
                }