From 7600faa265e30c62220fe066002f0bdd116a7e48 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 26 Dec 2022 13:01:27 +0200 Subject: [PATCH] Reject architecture specification conflicts for all fields This gives errors for nonsensical stuff like linux-windows-32-64-gnu-msvc, which was previously accepted. --- source/architecture.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; } -- 2.43.0