X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farchitecture.cpp;h=758d8b9b3a264d5f3905d9d18f10b033b7849e15;hb=7600faa265e30c62220fe066002f0bdd116a7e48;hp=48c6a204b17fc43220086ca207c68817739c9179;hpb=564160e126f525dda52f27044d29b479088da191;p=builder.git diff --git a/source/architecture.cpp b/source/architecture.cpp index 48c6a20..758d8b9 100644 --- a/source/architecture.cpp +++ b/source/architecture.cpp @@ -96,9 +96,7 @@ const char *aliases[] = } Architecture::Architecture(Builder &b, const string &spec): - builder(b), - bits(0), - native(false) + builder(b) { if(spec.empty()) { @@ -140,6 +138,17 @@ Architecture::Architecture(Builder &b, const string &spec): toolchain = "gnu"; } + update(); +} + +void Architecture::refine(const string &spec) +{ + parse_specification(spec); + update(); +} + +void Architecture::update() +{ name = type; if(!cpu.empty()) name += format("-%s", cpu); @@ -147,6 +156,7 @@ Architecture::Architecture(Builder &b, const string &spec): name += format("-%s", fpu); name += format("-%d-%s-%s", bits, system, toolchain); + filename_patterns.clear(); if(system=="windows") { add_pattern("%.dll"); @@ -292,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; } @@ -299,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; }