From: Mikko Rasa Date: Mon, 26 Dec 2022 11:01:27 +0000 (+0200) Subject: Reject architecture specification conflicts for all fields X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7600faa265e30c62220fe066002f0bdd116a7e48;p=builder.git Reject architecture specification conflicts for all fields This gives errors for nonsensical stuff like linux-windows-32-64-gnu-msvc, which was previously accepted. --- diff --git a/source/architecture.cpp b/source/architecture.cpp index 5f8aea0..758d8b9 100644 --- a/source/architecture.cpp +++ b/source/architecture.cpp @@ -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(p); + unsigned b = lexical_cast(p); + if(bits && b!=bits) + throw invalid_argument("Conflicting bits specification"); + bits = b; ok = true; }