From df2ca2c72fd7d267e27c1643c5d6ac9fa3b6114a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 6 Dec 2017 10:37:08 +0200 Subject: Handle system version in Clang's *-windows-msvc target triplet --- libbutl/target-triplet.cxx | 17 +++++++++-------- libbutl/target-triplet.mxx | 29 +++++++++++++++-------------- tests/target-triplet/driver.cxx | 8 ++++++++ 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx index dfd93b4..0b7247e 100644 --- a/libbutl/target-triplet.cxx +++ b/libbutl/target-triplet.cxx @@ -116,14 +116,15 @@ 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) + 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) { version.assign (system, v, string::npos); system.resize (system.size () - version.size ()); diff --git a/libbutl/target-triplet.mxx b/libbutl/target-triplet.mxx index b0b7291..39a62d0 100644 --- a/libbutl/target-triplet.mxx +++ b/libbutl/target-triplet.mxx @@ -79,20 +79,21 @@ LIBBUTL_MODEXPORT namespace butl // // Some examples of canonicalization and splitting: // - // x86_64-apple-darwin14.5.0 x86_64 apple darwin 14.5.0 - // x86_64-unknown-freebsd10.2 x86_64 freebsd 10.2 - // i686-elf i686 elf - // arm-eabi arm eabi - // arm-none-eabi arm eabi - // arm-none-linux-gnueabi arm linux-gnueabi - // arm-softfloat-linux-gnu arm softfloat linux-gnu - // i686-pc-mingw32 i686 mingw32 - // i686-w64-mingw32 i686 w64 mingw32 - // i686-lfs-linux-gnu i686 lfs linux-gnu - // x86_64-unknown-linux-gnu x86_64 linux-gnu - // x86_64-linux-gnux32 x86_64 linux-gnux32 - // x86_64-microsoft-win32-msvc14.0 x86_64 microsoft win32-msvc 14.0 - // x86_64-pc-windows-msvc x86_64 windows-msvc + // x86_64-apple-darwin14.5.0 x86_64 apple darwin 14.5.0 + // x86_64-unknown-freebsd10.2 x86_64 freebsd 10.2 + // i686-elf i686 elf + // arm-eabi arm eabi + // arm-none-eabi arm eabi + // arm-none-linux-gnueabi arm linux-gnueabi + // arm-softfloat-linux-gnu arm softfloat linux-gnu + // i686-pc-mingw32 i686 mingw32 + // i686-w64-mingw32 i686 w64 mingw32 + // i686-lfs-linux-gnu i686 lfs linux-gnu + // x86_64-unknown-linux-gnu x86_64 linux-gnu + // x86_64-linux-gnux32 x86_64 linux-gnux32 + // x86_64-microsoft-win32-msvc14.0 x86_64 microsoft win32-msvc 14.0 + // x86_64-pc-windows-msvc x86_64 windows-msvc + // x86_64-pc-windows-msvc19.11.25547 x86_64 windows-msvc 19.11.25547 // // Similar to version splitting, for certain commonly-used targets we also // derive the "target class" which can be used as a shorthand, more diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index 78329bd..1bed65b 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -122,9 +122,17 @@ main () "x86_64-microsoft-win32-msvc14.0", "x86_64", "microsoft", "win32-msvc", "14.0", "windows")); + assert (test ("x86_64-windows-msvc", + "x86_64-windows-msvc", + "x86_64", "", "windows-msvc", "", "windows")); + assert (test ("x86_64-pc-windows-msvc", "x86_64-windows-msvc", "x86_64", "", "windows-msvc", "", "windows")); + + assert (test ("x86_64-pc-windows-msvc19.11.25547", + "x86_64-windows-msvc19.11.25547", + "x86_64", "", "windows-msvc", "19.11.25547", "windows")); } static bool -- cgit v1.1