aboutsummaryrefslogtreecommitdiff
path: root/libbutl/target-triplet.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-08-24 11:37:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-08-24 11:37:22 +0200
commitbeb827d154cdc96dfe3042034bb301f6134f4259 (patch)
treed65c078506a5dd551ce557da13121caec33dd91a /libbutl/target-triplet.cxx
parentdfb4e3b363ec39c0b1744d9edbf7b2ed89b04ad7 (diff)
Add target_triplet::representation() in addition to string()
Also stop stripping `none-` prefix from the system component.
Diffstat (limited to 'libbutl/target-triplet.cxx')
-rw-r--r--libbutl/target-triplet.cxx29
1 files changed, 24 insertions, 5 deletions
diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx
index c2535b1..f59875f 100644
--- a/libbutl/target-triplet.cxx
+++ b/libbutl/target-triplet.cxx
@@ -71,11 +71,6 @@ namespace butl
if (l != p)
bad ("too many components");
-
- // Handle the none-* case here.
- //
- if (s.compare (l + 1, 5, "none-") == 0)
- l += 5;
}
else
{
@@ -170,4 +165,28 @@ namespace butl
return r;
}
+
+ std::string target_triplet::
+ representation () const
+ {
+ std::string r (cpu);
+
+ {
+ if (!r.empty ()) r += '-';
+ r += vendor.empty () ? "unknown" : vendor.c_str ();
+ }
+
+ if (!system.empty ())
+ {
+ if (!r.empty ()) r += '-';
+ r += system;
+ }
+
+ if (!version.empty ())
+ {
+ r += version;
+ }
+
+ return r;
+ }
}