From 5d7f4abad8b452490f19db16bed031392dc4d1fd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Aug 2020 11:47:08 +0200 Subject: Recognize *-nto-qnx target triplets, extract version --- libbutl/target-triplet.cxx | 26 ++++++++++++++------------ tests/target-triplet/driver.cxx | 8 +++++++- 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. // -- cgit v1.1