From 63d2400a2c1cff42a8e3ea3d8b4c77b862c82bc7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 23 Sep 2017 00:14:37 +0200 Subject: Undo modularization hacks for VC --- libbutl/buildfile | 2 +- libbutl/fdstream.mxx | 5 ++--- libbutl/optional.mxx | 2 +- libbutl/path.cxx | 3 +-- libbutl/path.ixx | 8 ++------ libbutl/path.mxx | 12 ++---------- libbutl/path.txx | 1 - libbutl/sha256.cxx | 9 ++++++--- libbutl/target-triplet.mxx | 3 +-- libbutl/utility.mxx | 10 +++++----- 10 files changed, 21 insertions(+), 34 deletions(-) diff --git a/libbutl/buildfile b/libbutl/buildfile index 6086fd7..ccf8908 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -62,7 +62,7 @@ if ($cxx.target.class == "windows") else cxx.libs += -lpthread -#@@ MOD bogus warning if module and dll-exported function called within DLL. +#@@ MOD VC bogus warning if module and dll-exported function called within DLL. # if ($cxx.features.modules && $cxx.id == 'msvc') cxx.loptions += /ignore:4217 diff --git a/libbutl/fdstream.mxx b/libbutl/fdstream.mxx index f84b88e..b2d4704 100644 --- a/libbutl/fdstream.mxx +++ b/libbutl/fdstream.mxx @@ -46,10 +46,9 @@ LIBBUTL_MODEXPORT namespace butl // struct nullfd_t {constexpr explicit nullfd_t (int) {}}; #if defined(__cpp_modules) && defined(__clang__) //@@ MOD Clang duplicate sym. - inline constexpr nullfd_t nullfd (-1); -#else - const/*expr*/ nullfd_t nullfd (-1); //@@ MOD VC multiple defs. + inline #endif + constexpr nullfd_t nullfd (-1); class LIBBUTL_SYMEXPORT auto_fd { diff --git a/libbutl/optional.mxx b/libbutl/optional.mxx index 4478f84..b0993d9 100644 --- a/libbutl/optional.mxx +++ b/libbutl/optional.mxx @@ -32,7 +32,7 @@ LIBBUTL_MODEXPORT namespace butl #if defined(__cpp_modules) && defined(__clang__) //@@ MOD Clang duplicate sym. inline #endif - const/*expr*/ nullopt_t nullopt (1); //@@ MOD VC multiple defs. + constexpr nullopt_t nullopt (1); template class optional diff --git a/libbutl/path.cxx b/libbutl/path.cxx index bbc4754..ac85016 100644 --- a/libbutl/path.cxx +++ b/libbutl/path.cxx @@ -112,8 +112,7 @@ namespace butl string_type const& d ( !root (s) ? s - //@@ MOD VC ADL does not seem to kick in for some reason... - : string_type (std::operator+ (s, directory_separator))); + : string_type (s + directory_separator)); if (_chdir (d.c_str ()) != 0) throw_generic_error (errno); diff --git a/libbutl/path.ixx b/libbutl/path.ixx index f983f5d..f86a57e 100644 --- a/libbutl/path.ixx +++ b/libbutl/path.ixx @@ -6,21 +6,17 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. { #ifdef _WIN32 template <> - LIBBUTL_SYMEXPORT //@@ MOD VC needs it for some reason. inline char path_traits:: tolower (char c) { - //@@ MOD VC-ICE return lcase (c); - return std::tolower (c); + return lcase (c); } template <> - LIBBUTL_SYMEXPORT //@@ MOD VC needs it for some reason. inline char path_traits:: toupper (char c) { - //@@ MOD VC-ICE return ucase (c); - return std::toupper (c); + return ucase (c); } #endif diff --git a/libbutl/path.mxx b/libbutl/path.mxx index 31101fc..4d843e5 100644 --- a/libbutl/path.mxx +++ b/libbutl/path.mxx @@ -18,7 +18,6 @@ #include #ifdef _WIN32 -#include // toupper/lower() @@ MOD TMP #include // replace() #endif #endif @@ -548,8 +547,6 @@ LIBBUTL_MODEXPORT namespace butl base_type (path_data&& d): path_data (std::move (d)) {} }; - //using base_type = path_data; // @@ MOD VC-ICE - using dir_type = basic_path>; // Init and cast. @@ -590,8 +587,6 @@ LIBBUTL_MODEXPORT namespace butl cast (data_type&); }; - struct exact_path_type {}; //@@ MOD TMP - template class basic_path: public K::base_type { @@ -638,9 +633,8 @@ LIBBUTL_MODEXPORT namespace butl // untouched. Note that no exception is thrown if the path is invalid. See // also representation()&& below. // - //@@ MOD VC-ICE enum exact_type {exact}; - static const exact_path_type exact; - basic_path (string_type&& s, exact_path_type) + enum exact_type {exact}; + basic_path (string_type&& s, exact_type) : base_type (K::init (std::move (s), true)) {} // Create a path as a sub-path identified by the [begin, end) range of @@ -1084,9 +1078,7 @@ LIBBUTL_MODEXPORT namespace butl explicit basic_path (data_type&& d): base_type (std::move (d)) {} - #ifndef _MSC_VER //@@ MOD VC ICE using base_type::_size; - #endif // Common implementation for operator/= and operator+=. // diff --git a/libbutl/path.txx b/libbutl/path.txx index 512e849..061728e 100644 --- a/libbutl/path.txx +++ b/libbutl/path.txx @@ -131,7 +131,6 @@ LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. // Throw system_error in case of other failures. Result and dir can be the // same instance. // - LIBBUTL_MODEXPORT //@@ MOD VC doesn't "see" it in impl unit unless exported. template bool basic_path_append_actual_name (std::basic_string& result, diff --git a/libbutl/sha256.cxx b/libbutl/sha256.cxx index b0b7301..be29871 100644 --- a/libbutl/sha256.cxx +++ b/libbutl/sha256.cxx @@ -32,7 +32,7 @@ extern "C" #include #include -#include // isxdigit(), toupper(), tolower() +#include // isxdigit() #include // invalid_argument #endif @@ -52,6 +52,9 @@ import std.core; #endif #endif +import butl.utility; // *case() +#else +#include #endif using namespace std; @@ -128,7 +131,7 @@ namespace butl if (i > 0 && i % 2 == 0) f += ":"; - f += toupper (c); //@@ MOD revert to ucase() + f += ucase (c); } return f; @@ -158,7 +161,7 @@ namespace butl if (!isxdigit (c)) bad (); - s += tolower (c); //@@ MOD revert to lcase() + s += lcase (c); } } diff --git a/libbutl/target-triplet.mxx b/libbutl/target-triplet.mxx index 9445aba..0b2c40a 100644 --- a/libbutl/target-triplet.mxx +++ b/libbutl/target-triplet.mxx @@ -145,8 +145,7 @@ LIBBUTL_MODEXPORT namespace butl explicit target_triplet (const std::string&); - //target_triplet () = default; - target_triplet () {} //@@ MOD (VC ICE) + target_triplet () = default; }; inline bool diff --git a/libbutl/utility.mxx b/libbutl/utility.mxx index 6a50186..d36b0d9 100644 --- a/libbutl/utility.mxx +++ b/libbutl/utility.mxx @@ -75,14 +75,14 @@ LIBBUTL_MODEXPORT namespace butl // http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_02) // char ucase (char); - std::string ucase (const char*, std::size_t = -1 /*@@ MOD VC ICE = std::string::npos*/); + std::string ucase (const char*, std::size_t = std::string::npos); std::string ucase (const std::string&); std::string& ucase (std::string&); void ucase (char*, std::size_t); char lcase (char); - std::string lcase (const char*, std::size_t = -1 /*@@ MOD VC ICE = std::string::npos*/); + std::string lcase (const char*, std::size_t = std::string::npos); std::string lcase (const std::string&); std::string& lcase (std::string&); void lcase (char*, std::size_t); @@ -100,12 +100,12 @@ LIBBUTL_MODEXPORT namespace butl int casecmp (char, char); int casecmp (const std::string&, const std::string&, - std::size_t = -1 /*@@ MOD VC ICE std::string::npos*/); + std::size_t = std::string::npos); int casecmp (const std::string&, const char*, - std::size_t = -1 /*@@ MOD VC ICE std::string::npos*/); + std::size_t = std::string::npos); - int casecmp (const char*, const char*, std::size_t = -1 /*MOD VC ICE std::string::npos*/); + int casecmp (const char*, const char*, std::size_t = std::string::npos); // Case-insensitive key comparators (i.e., to be used in sets, maps, etc). // -- cgit v1.1