diff options
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | libcutl/fs/auto-remove.hxx | 30 | ||||
-rw-r--r-- | libcutl/re/re.cxx | 76 | ||||
-rw-r--r-- | libcutl/shared-ptr/base.cxx | 2 | ||||
-rw-r--r-- | manifest | 8 | ||||
-rw-r--r-- | tests/compiler/cxx-indenter/driver.cxx | 3 | ||||
-rw-r--r-- | tests/compiler/sloc-counter/driver.cxx | 4 | ||||
-rw-r--r-- | tests/compiler/sloc-counter/test.cxx | 5 | ||||
-rw-r--r-- | tests/compiler/traversal/driver.cxx | 3 | ||||
-rw-r--r-- | tests/container/multi-index/driver.cxx | 4 | ||||
-rw-r--r-- | tests/fs/path/driver.cxx | 4 | ||||
-rw-r--r-- | tests/re/driver.cxx | 4 | ||||
-rw-r--r-- | tests/shared-ptr/driver.cxx | 10 |
16 files changed, 95 insertions, 74 deletions
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2013-2020 Code Synthesis Tools CC. +Copyright (c) 2013-2023 Code Synthesis. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -1,3 +1,7 @@ +For all further versions see the change log at: + +https://git.codesynthesis.com/cgit/libcutl/libcutl/log/ + Version 1.10.0 * fs::basic_path::string() now returns the string by reference. @@ -1,5 +1,6 @@ -libcutl is a C++ utility library. It contains a collection of generic and -fairly independent components. See doc/components.txt for an overview. +libcutl is a C++ utility library for compilers. It contains a collection of +generic and fairly independent components. See doc/components.txt for an +overview. See the NEWS file for the user-visible changes from the previous release. @@ -1,5 +0,0 @@ -@@ Add memprof? -@@ path::base() and ".." & "." special directories. -@@ No support for Windows network directories. - - diff --git a/libcutl/fs/auto-remove.hxx b/libcutl/fs/auto-remove.hxx index c55f6f9..1badfa7 100644 --- a/libcutl/fs/auto-remove.hxx +++ b/libcutl/fs/auto-remove.hxx @@ -5,6 +5,7 @@ #define LIBCUTL_FS_AUTO_REMOVE_HXX #include <vector> +#include <utility> #include <libcutl/fs/path.hxx> #include <libcutl/fs/exception.hxx> @@ -19,6 +20,11 @@ namespace cutl // struct LIBCUTL_EXPORT auto_remove { + auto_remove () + : canceled_ (true) + { + } + explicit auto_remove (path const& p) : path_ (p), canceled_ (false) @@ -33,11 +39,29 @@ namespace cutl canceled_ = true; } - private: - auto_remove (auto_remove const&); + // Movable-only type. Move-assignment cancels the lhs object. + // + auto_remove (auto_remove&& x) + : path_ (std::move (x.path_)), canceled_ (x.canceled_) + { + x.canceled_ = true; + } auto_remove& - operator= (auto_remove const&); + operator= (auto_remove&& x) + { + if (this != &x) + { + path_ = std::move (x.path_); + canceled_ = x.canceled_; + x.canceled_ = true; + } + + return *this; + } + + auto_remove (auto_remove const&) = delete; + auto_remove& operator= (auto_remove const&) = delete; private: path path_; diff --git a/libcutl/re/re.cxx b/libcutl/re/re.cxx index 524c416..0bcbe96 100644 --- a/libcutl/re/re.cxx +++ b/libcutl/re/re.cxx @@ -3,25 +3,9 @@ #include <libcutl/re.hxx> -// It is either C++11 regex or Boost. -// -// Note that some compiler/runtime combinations don't have usable C++11 -// regex. For example Clang 3.5 with libstdc++ from GCC 4.9. In this case you -// can fall back to using Boost regex by passing -DLIBCUTL_BOOST_REGEX -// preprocessor option when building libcutl. -// -// @@ Should this rather be a (custom) config.* variable? -// -#if !defined(LIBCUTL_BOOST_REGEX) -# include <regex> -# include <locale> -# include <cstddef> // size_t -#else -# ifndef LIBCUTL_BOOST_REGEX -# define LIBCUTL_BOOST_REGEX -# endif -# include <boost/tr1/regex.hpp> -#endif +#include <regex> +#include <locale> +#include <cstddef> // size_t using namespace std; @@ -29,12 +13,6 @@ namespace cutl { namespace re { -#ifdef LIBCUTL_BOOST_REGEX - namespace ire = std::tr1; -#else - namespace ire = std; -#endif - // // format_base // @@ -52,17 +30,17 @@ namespace cutl struct basic_regex<C>::impl { typedef basic_string<C> string_type; - typedef ire::basic_regex<C> regex_type; + typedef std::basic_regex<C> regex_type; typedef typename regex_type::flag_type flag_type; impl () {} impl (regex_type const& r): r (r) {} impl (string_type const& s, bool icase) { - flag_type f (ire::regex_constants::ECMAScript); + flag_type f (std::regex_constants::ECMAScript); if (icase) - f |= ire::regex_constants::icase; + f |= std::regex_constants::icase; r.assign (s, f); } @@ -130,15 +108,15 @@ namespace cutl impl_ = s == 0 ? new impl : new impl (*s, icase); else { - impl::flag_type f (ire::regex_constants::ECMAScript); + impl::flag_type f (std::regex_constants::ECMAScript); if (icase) - f |= ire::regex_constants::icase; + f |= std::regex_constants::icase; impl_->r.assign (*s, f); } } - catch (ire::regex_error const& e) + catch (std::regex_error const& e) { throw basic_format<char> (s == 0 ? "" : *s, e.what ()); } @@ -158,15 +136,15 @@ namespace cutl impl_ = s == 0 ? new impl : new impl (*s, icase); else { - impl::flag_type f (ire::regex_constants::ECMAScript); + impl::flag_type f (std::regex_constants::ECMAScript); if (icase) - f |= ire::regex_constants::icase; + f |= std::regex_constants::icase; impl_->r.assign (*s, f); } } - catch (ire::regex_error const& e) + catch (std::regex_error const& e) { throw basic_format<wchar_t> (s == 0 ? L"" : *s, e.what ()); } @@ -178,28 +156,28 @@ namespace cutl LIBCUTL_EXPORT bool basic_regex<char>:: match (string_type const& s) const { - return ire::regex_match (s, impl_->r); + return std::regex_match (s, impl_->r); } template <> LIBCUTL_EXPORT bool basic_regex<wchar_t>:: match (string_type const& s) const { - return ire::regex_match (s, impl_->r); + return std::regex_match (s, impl_->r); } template <> LIBCUTL_EXPORT bool basic_regex<char>:: search (string_type const& s) const { - return ire::regex_search (s, impl_->r); + return std::regex_search (s, impl_->r); } template <> LIBCUTL_EXPORT bool basic_regex<wchar_t>:: search (string_type const& s) const { - return ire::regex_search (s, impl_->r); + return std::regex_search (s, impl_->r); } // If we are using C++11 regex then extend the standard ECMA-262 @@ -222,15 +200,10 @@ namespace cutl template <typename C> static basic_string<C> regex_replace_ex (const basic_string<C>& s, - const ire::basic_regex<C>& re, + const std::basic_regex<C>& re, const basic_string<C>& fmt, - ire::regex_constants::match_flag_type flags) + std::regex_constants::match_flag_type flags) { -#ifdef LIBCUTL_BOOST_REGEX - // Boost regex already does what we need. - // - return ire::regex_replace (s, re, fmt, flags); -#else using string_type = basic_string<C>; using str_it = typename string_type::const_iterator; using regex_it = regex_iterator<str_it>; @@ -426,7 +399,6 @@ namespace cutl r.append (ub, s.end ()); // Append the rightmost non-matched substring. return r; -#endif } template <> @@ -435,11 +407,11 @@ namespace cutl string_type const& sub, bool first_only) const { - ire::regex_constants::match_flag_type f ( - ire::regex_constants::format_default); + std::regex_constants::match_flag_type f ( + std::regex_constants::format_default); if (first_only) - f |= ire::regex_constants::format_first_only; + f |= std::regex_constants::format_first_only; return regex_replace_ex (s, impl_->r, sub, f); } @@ -450,11 +422,11 @@ namespace cutl string_type const& sub, bool first_only) const { - ire::regex_constants::match_flag_type f ( - ire::regex_constants::format_default); + std::regex_constants::match_flag_type f ( + std::regex_constants::format_default); if (first_only) - f |= ire::regex_constants::format_first_only; + f |= std::regex_constants::format_first_only; return regex_replace_ex (s, impl_->r, sub, f); } diff --git a/libcutl/shared-ptr/base.cxx b/libcutl/shared-ptr/base.cxx index a3bc774..10e998f 100644 --- a/libcutl/shared-ptr/base.cxx +++ b/libcutl/shared-ptr/base.cxx @@ -33,6 +33,8 @@ operator new (size_t n, cutl::share s) // of this platform. Twice the pointer size is a good guess for // most platforms. // + // @@ Need to redo this properly using alignof(std::max_align_t). + // size_t* p = static_cast<size_t*> (operator new (n + 2 * sizeof (size_t))); *p++ = 1; // Initial count. *p++ = 0xDEADBEEF; // Signature. @@ -1,7 +1,7 @@ : 1 name: libcutl -version: 1.11.0-b.8.z -summary: C++ utility library +version: 1.11.0 +summary: C++ utility library for compilers license: MIT topics: C++, utility description-file: README @@ -12,5 +12,5 @@ email: libcutl-users@codesynthesis.com ; Mailing list build-warning-email: builds@codesynthesis.com builds: all requires: c++11 -depends: * build2 >= 0.13.0 -depends: * bpkg >= 0.13.0 +depends: * build2 >= 0.16.0 +depends: * bpkg >= 0.16.0 diff --git a/tests/compiler/cxx-indenter/driver.cxx b/tests/compiler/cxx-indenter/driver.cxx index c73aa8d..a0e8be2 100644 --- a/tests/compiler/cxx-indenter/driver.cxx +++ b/tests/compiler/cxx-indenter/driver.cxx @@ -7,6 +7,9 @@ #include <libcutl/compiler/code-stream.hxx> #include <libcutl/compiler/cxx-indenter.hxx> +#undef NDEBUG +#include <cassert> + using namespace std; using namespace cutl::compiler; diff --git a/tests/compiler/sloc-counter/driver.cxx b/tests/compiler/sloc-counter/driver.cxx index c85c571..b888d42 100644 --- a/tests/compiler/sloc-counter/driver.cxx +++ b/tests/compiler/sloc-counter/driver.cxx @@ -3,12 +3,14 @@ #include <fstream> #include <sstream> -#include <cassert> #include <iostream> #include <libcutl/compiler/code-stream.hxx> #include <libcutl/compiler/sloc-counter.hxx> +#undef NDEBUG +#include <cassert> + using namespace std; using namespace cutl::compiler; diff --git a/tests/compiler/sloc-counter/test.cxx b/tests/compiler/sloc-counter/test.cxx index ff0f5b2..70201ee 100644 --- a/tests/compiler/sloc-counter/test.cxx +++ b/tests/compiler/sloc-counter/test.cxx @@ -12,6 +12,9 @@ #include <iostream> +#undef NDEBUG +#include <cassert> + char str[] = "multi\ line\ string\ @@ -25,7 +28,7 @@ int main( char* argv[] /*array*/) { /* comment start */ int x = 0; - char* s = + char* s = /* comment start */"foo"; int y = 2 /* tricky stuff *// diff --git a/tests/compiler/traversal/driver.cxx b/tests/compiler/traversal/driver.cxx index e7948f5..f8b0c84 100644 --- a/tests/compiler/traversal/driver.cxx +++ b/tests/compiler/traversal/driver.cxx @@ -9,6 +9,9 @@ #include <libcutl/compiler/type-info.hxx> #include <libcutl/compiler/traversal.hxx> +#undef NDEBUG +#include <cassert> + using namespace std; using namespace cutl; diff --git a/tests/container/multi-index/driver.cxx b/tests/container/multi-index/driver.cxx index 6d4aa50..0fc642a 100644 --- a/tests/container/multi-index/driver.cxx +++ b/tests/container/multi-index/driver.cxx @@ -4,11 +4,13 @@ #include <map> #include <list> #include <string> -#include <cassert> #include <iostream> #include <libcutl/container/multi-index.hxx> +#undef NDEBUG +#include <cassert> + using namespace std; using namespace cutl::container; diff --git a/tests/fs/path/driver.cxx b/tests/fs/path/driver.cxx index ca1f2b6..75276d5 100644 --- a/tests/fs/path/driver.cxx +++ b/tests/fs/path/driver.cxx @@ -1,11 +1,13 @@ // file : tests/fs/path/driver.cxx // license : MIT; see accompanying LICENSE file -#include <cassert> #include <iostream> #include <libcutl/fs/path.hxx> +#undef NDEBUG +#include <cassert> + using std::cerr; using std::endl; diff --git a/tests/re/driver.cxx b/tests/re/driver.cxx index bfa0e05..f82c750 100644 --- a/tests/re/driver.cxx +++ b/tests/re/driver.cxx @@ -2,11 +2,13 @@ // license : MIT; see accompanying LICENSE file #include <string> -#include <cassert> #include <iostream> #include <libcutl/re.hxx> +#undef NDEBUG +#include <cassert> + using namespace cutl::re; int diff --git a/tests/shared-ptr/driver.cxx b/tests/shared-ptr/driver.cxx index 4b184ac..d0c7f8b 100644 --- a/tests/shared-ptr/driver.cxx +++ b/tests/shared-ptr/driver.cxx @@ -2,10 +2,12 @@ // license : MIT; see accompanying LICENSE file #include <string> -#include <cassert> #include <libcutl/shared-ptr.hxx> +#undef NDEBUG +#include <cassert> + using namespace cutl; struct type @@ -97,7 +99,11 @@ main () // Error handling. This can theoretically can segfault and it trips up // the address sanitizer. // -#ifndef __SANITIZE_ADDRESS__ + // @@ This now also trips Clang 16 on various platforms, so disable for + // now. + // +#if 0 +//#ifndef __SANITIZE_ADDRESS__ { type* x (new type (5, "foo")); |