aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-08-24 11:47:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-08-24 11:47:08 +0200
commit5d7f4abad8b452490f19db16bed031392dc4d1fd (patch)
treeba4d513d26621dddac23bb77fe1a26d473fb5f72
parentbeb827d154cdc96dfe3042034bb301f6134f4259 (diff)
Recognize *-nto-qnx target triplets, extract version
-rw-r--r--libbutl/target-triplet.cxx26
-rw-r--r--tests/target-triplet/driver.cxx8
2 files changed, 21 insertions, 13 deletions
diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx
index f59875f..17337b3 100644
--- a/libbutl/target-triplet.cxx
+++ b/libbutl/target-triplet.cxx
@@ -76,9 +76,10 @@ namespace butl
{
// See if this is one of the well-known non-vendors.
//
- if (s.compare (f, n, "linux") == 0 ||
- s.compare (f, n, "windows") == 0 ||
- s.compare (f, n, "kfreebsd") == 0)
+ if (s.compare (f, n, "linux") == 0 ||
+ s.compare (f, n, "windows") == 0 ||
+ s.compare (f, n, "kfreebsd") == 0 ||
+ s.compare (f, n, "nto") == 0)
{
l = f - 1;
n = 0; // No VENDOR.
@@ -109,15 +110,16 @@ namespace butl
// Extract VERSION for some recognized systems.
//
string::size_type v (0);
- if (system.compare (0, (v = 6), "darwin") == 0 ||
- system.compare (0, (v = 7), "freebsd") == 0 ||
- system.compare (0, (v = 7), "openbsd") == 0 ||
- system.compare (0, (v = 6), "netbsd") == 0 ||
- system.compare (0, (v = 7), "solaris") == 0 ||
- system.compare (0, (v = 3), "aix") == 0 ||
- system.compare (0, (v = 4), "hpux") == 0 ||
- system.compare (0, (v = 10), "win32-msvc") == 0 ||
- system.compare (0, (v = 12), "windows-msvc") == 0)
+ if (system.compare (0, (v = 6), "darwin") == 0 ||
+ system.compare (0, (v = 7), "freebsd") == 0 ||
+ system.compare (0, (v = 7), "openbsd") == 0 ||
+ system.compare (0, (v = 6), "netbsd") == 0 ||
+ system.compare (0, (v = 7), "solaris") == 0 ||
+ system.compare (0, (v = 3), "aix") == 0 ||
+ system.compare (0, (v = 4), "hpux") == 0 ||
+ system.compare (0, (v = 10), "win32-msvc") == 0 ||
+ system.compare (0, (v = 12), "windows-msvc") == 0 ||
+ system.compare (0, (v = 7), "nto-qnx") == 0)
{
version.assign (system, v, string::npos);
system.resize (system.size () - version.size ());
diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx
index 36131a6..cc375e0 100644
--- a/tests/target-triplet/driver.cxx
+++ b/tests/target-triplet/driver.cxx
@@ -101,7 +101,13 @@ main ()
"x86_64-netbsd",
"x86_64", "", "netbsd", "", "bsd"));
-
+ assert (test ("aarch64-unknown-nto-qnx7.0.0",
+ "aarch64-nto-qnx7.0.0",
+ "aarch64", "", "nto-qnx", "7.0.0", "other"));
+
+ assert (test ("aarch64-nto-qnx7.0.0",
+ "aarch64-nto-qnx7.0.0",
+ "aarch64", "", "nto-qnx", "7.0.0", "other"));
// Version extraction.
//