aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cutl/buildfile4
-rw-r--r--cutl/compiler/context.hxx4
-rw-r--r--cutl/compiler/type-id.hxx2
-rw-r--r--cutl/compiler/type-info.hxx8
-rw-r--r--cutl/container/any.hxx6
-rw-r--r--cutl/container/graph.hxx6
-rw-r--r--cutl/details/config.hxx6
-rw-r--r--cutl/exception.cxx2
-rw-r--r--cutl/exception.hxx3
-rw-r--r--cutl/fs/exception.cxx2
-rw-r--r--cutl/fs/exception.hxx4
-rw-r--r--cutl/fs/path.cxx2
-rw-r--r--cutl/fs/path.hxx4
-rw-r--r--cutl/meta/polymorphic-p.hxx4
-rw-r--r--cutl/re.hxx10
-rw-r--r--cutl/re/re.cxx75
-rw-r--r--cutl/shared-ptr/base.cxx9
-rw-r--r--cutl/shared-ptr/base.hxx21
-rw-r--r--cutl/shared-ptr/base.ixx9
19 files changed, 106 insertions, 75 deletions
diff --git a/cutl/buildfile b/cutl/buildfile
index 192a84b..410baf8 100644
--- a/cutl/buildfile
+++ b/cutl/buildfile
@@ -2,11 +2,11 @@
# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
# license : MIT; see accompanying LICENSE file
-# {hxx }{ re } \
-# re/{ txx cxx}{ re } \
lib{cutl}: \
{hxx cxx}{ exception } \
+ {hxx }{ re } \
+ re/{ txx cxx}{ re } \
{hxx }{ shared-ptr } \
shared-ptr/{hxx ixx txx cxx}{ base } \
{hxx }{ static-ptr } \
diff --git a/cutl/compiler/context.hxx b/cutl/compiler/context.hxx
index 2933e36..15d9402 100644
--- a/cutl/compiler/context.hxx
+++ b/cutl/compiler/context.hxx
@@ -22,8 +22,8 @@ namespace cutl
class LIBCUTL_EXPORT context
{
public:
- struct LIBCUTL_EXPORT no_entry: exception {};
- struct LIBCUTL_EXPORT typing: exception {};
+ struct no_entry: exception {};
+ struct typing: exception {};
public:
context () {}
diff --git a/cutl/compiler/type-id.hxx b/cutl/compiler/type-id.hxx
index f37454e..a23393b 100644
--- a/cutl/compiler/type-id.hxx
+++ b/cutl/compiler/type-id.hxx
@@ -13,7 +13,7 @@ namespace cutl
{
namespace compiler
{
- class LIBCUTL_EXPORT type_id
+ class type_id
{
public:
template<typename X>
diff --git a/cutl/compiler/type-info.hxx b/cutl/compiler/type-info.hxx
index 8d9a32b..4e73d4d 100644
--- a/cutl/compiler/type-info.hxx
+++ b/cutl/compiler/type-info.hxx
@@ -27,7 +27,7 @@ namespace cutl
//
//
- class LIBCUTL_EXPORT base_info
+ class base_info
{
public:
base_info (type_id const&);
@@ -46,7 +46,7 @@ namespace cutl
//
//
- class LIBCUTL_EXPORT type_info
+ class type_info
{
typedef std::vector<base_info> bases;
@@ -78,12 +78,12 @@ namespace cutl
//
//
- class LIBCUTL_EXPORT no_type_info: exception {};
+ class no_type_info: exception {};
LIBCUTL_EXPORT type_info const&
lookup (type_id const&);
- LIBCUTL_EXPORT type_info const&
+ type_info const&
lookup (std::type_info const&);
template <typename X>
diff --git a/cutl/container/any.hxx b/cutl/container/any.hxx
index c8d6308..3a31602 100644
--- a/cutl/container/any.hxx
+++ b/cutl/container/any.hxx
@@ -10,16 +10,14 @@
#include <cutl/exception.hxx>
-#include <cutl/details/export.hxx>
-
namespace cutl
{
namespace container
{
- class LIBCUTL_EXPORT any
+ class any
{
public:
- struct LIBCUTL_EXPORT typing: exception {};
+ struct typing: exception {};
public:
any ()
diff --git a/cutl/container/graph.hxx b/cutl/container/graph.hxx
index 9c1afe2..3f98c2a 100644
--- a/cutl/container/graph.hxx
+++ b/cutl/container/graph.hxx
@@ -10,14 +10,12 @@
#include <cutl/exception.hxx>
#include <cutl/shared-ptr.hxx>
-#include <cutl/details/export.hxx>
-
namespace cutl
{
namespace container
{
- struct LIBCUTL_EXPORT no_edge: exception {};
- struct LIBCUTL_EXPORT no_node: exception {};
+ struct no_edge: exception {};
+ struct no_node: exception {};
template <typename N, typename E>
class graph
diff --git a/cutl/details/config.hxx b/cutl/details/config.hxx
index c57c50e..40c8fba 100644
--- a/cutl/details/config.hxx
+++ b/cutl/details/config.hxx
@@ -25,6 +25,12 @@
# endif
#endif
+#ifdef LIBCUTL_CXX11
+# define LIBCUTL_NOTHROW_NOEXCEPT noexcept
+#else
+# define LIBCUTL_NOTHROW_NOEXCEPT throw()
+#endif
+
#ifdef LIBCUTL_BUILD2
# ifdef _MSC_VER
# include <cutl/details/build2/config-vc.h>
diff --git a/cutl/exception.cxx b/cutl/exception.cxx
index 6f69aa7..339c500 100644
--- a/cutl/exception.cxx
+++ b/cutl/exception.cxx
@@ -9,7 +9,7 @@
namespace cutl
{
char const* exception::
- what () const throw ()
+ what () const LIBCUTL_NOTHROW_NOEXCEPT
{
return typeid (*this).name ();
}
diff --git a/cutl/exception.hxx b/cutl/exception.hxx
index e8952fd..700e642 100644
--- a/cutl/exception.hxx
+++ b/cutl/exception.hxx
@@ -7,6 +7,7 @@
#include <exception>
+#include <cutl/details/config.hxx>
#include <cutl/details/export.hxx>
namespace cutl
@@ -16,7 +17,7 @@ namespace cutl
// By default return the exception type name ( typeid (*this).name () ).
//
virtual char const*
- what () const throw ();
+ what () const LIBCUTL_NOTHROW_NOEXCEPT;
};
}
diff --git a/cutl/fs/exception.cxx b/cutl/fs/exception.cxx
index 3fbd26b..c3f8da2 100644
--- a/cutl/fs/exception.cxx
+++ b/cutl/fs/exception.cxx
@@ -9,7 +9,7 @@ namespace cutl
namespace fs
{
char const* error::
- what () const throw ()
+ what () const LIBCUTL_NOTHROW_NOEXCEPT
{
return "filesystem error";
}
diff --git a/cutl/fs/exception.hxx b/cutl/fs/exception.hxx
index d6c9601..de0e8f9 100644
--- a/cutl/fs/exception.hxx
+++ b/cutl/fs/exception.hxx
@@ -7,6 +7,8 @@
#include <cutl/exception.hxx>
+#include <cutl/details/config.hxx>
+
namespace cutl
{
namespace fs
@@ -24,7 +26,7 @@ namespace cutl
}
virtual char const*
- what () const throw ();
+ what () const LIBCUTL_NOTHROW_NOEXCEPT;
private:
int code_;
diff --git a/cutl/fs/path.cxx b/cutl/fs/path.cxx
index b106ea0..4faf401 100644
--- a/cutl/fs/path.cxx
+++ b/cutl/fs/path.cxx
@@ -24,7 +24,7 @@ namespace cutl
namespace fs
{
char const* invalid_path_base::
- what () const throw ()
+ what () const LIBCUTL_NOTHROW_NOEXCEPT
{
return "invalid filesystem path";
}
diff --git a/cutl/fs/path.hxx b/cutl/fs/path.hxx
index d7d2c0c..b1cf92d 100644
--- a/cutl/fs/path.hxx
+++ b/cutl/fs/path.hxx
@@ -10,6 +10,7 @@
#include <cutl/exception.hxx>
+#include <cutl/details/config.hxx>
#include <cutl/details/export.hxx>
namespace cutl
@@ -121,7 +122,7 @@ namespace cutl
{
public:
virtual char const*
- what () const throw ();
+ what () const LIBCUTL_NOTHROW_NOEXCEPT;
};
template <typename C>
@@ -132,7 +133,6 @@ namespace cutl
invalid_basic_path (C const* p): path_ (p) {}
invalid_basic_path (string_type const& p): path_ (p) {}
- ~invalid_basic_path () throw () {}
string_type const&
path () const
diff --git a/cutl/meta/polymorphic-p.hxx b/cutl/meta/polymorphic-p.hxx
index dd820db..77d1901 100644
--- a/cutl/meta/polymorphic-p.hxx
+++ b/cutl/meta/polymorphic-p.hxx
@@ -5,6 +5,8 @@
#ifndef CUTL_META_POLYMORPHIC_HXX
#define CUTL_META_POLYMORPHIC_HXX
+#include <cutl/details/config.hxx>
+
#include <cutl/meta/class-p.hxx>
#include <cutl/meta/remove-cv.hxx>
@@ -36,7 +38,7 @@ namespace cutl
t2 ();
virtual
- ~t2 () throw ();
+ ~t2 () LIBCUTL_NOTHROW_NOEXCEPT;
};
static const bool r = sizeof (t1) == sizeof (t2);
diff --git a/cutl/re.hxx b/cutl/re.hxx
index b5bbdb9..176bd9d 100644
--- a/cutl/re.hxx
+++ b/cutl/re.hxx
@@ -9,6 +9,8 @@
#include <ostream>
#include <cutl/exception.hxx>
+
+#include <cutl/details/config.hxx>
#include <cutl/details/export.hxx>
namespace cutl
@@ -17,9 +19,6 @@ namespace cutl
{
struct LIBCUTL_EXPORT format_base: exception
{
- virtual
- ~format_base () throw ();
-
format_base (std::string const& d): description_ (d) {}
std::string const&
@@ -29,7 +28,7 @@ namespace cutl
}
virtual char const*
- what () const throw ();
+ what () const LIBCUTL_NOTHROW_NOEXCEPT;
protected:
std::string description_;
@@ -38,9 +37,6 @@ namespace cutl
template <typename C>
struct basic_format: format_base
{
- virtual
- ~basic_format () throw () {}
-
basic_format (std::basic_string<C> const& e, std::string const& d)
: format_base (d), regex_ (e) {}
diff --git a/cutl/re/re.cxx b/cutl/re/re.cxx
index 3b132ab..5e1dc4a 100644
--- a/cutl/re/re.cxx
+++ b/cutl/re/re.cxx
@@ -4,12 +4,22 @@
#include <cutl/re.hxx>
-#include <cutl/details/config.hxx> // LIBCUTL_EXTERNAL_BOOST
-
-#ifndef LIBCUTL_EXTERNAL_BOOST
-# include <cutl/details/boost/tr1/regex.hpp>
+#include <cutl/details/config.hxx> // LIBCUTL_*
+
+// For build2 build it is either C++11 regex or external Boost.
+//
+#ifdef LIBCUTL_BUILD2
+# ifdef LIBCUTL_CXX11
+# include <regex>
+# else
+# include <boost/tr1/regex.hpp>
+# endif
#else
-# include <boost/tr1/regex.hpp>
+# ifndef LIBCUTL_EXTERNAL_BOOST
+# include <cutl/details/boost/tr1/regex.hpp>
+# else
+# include <boost/tr1/regex.hpp>
+# endif
#endif
using namespace std;
@@ -18,17 +28,18 @@ namespace cutl
{
namespace re
{
+#if defined(LIBCUTL_BUILD2) && defined(LIBCUTL_CXX11)
+ namespace ire = std;
+#else
+ namespace ire = std::tr1;
+#endif
+
//
// format_base
//
- format_base::
- ~format_base () throw ()
- {
- }
-
char const* format_base::
- what () const throw ()
+ what () const LIBCUTL_NOTHROW_NOEXCEPT
{
return description_.c_str ();
}
@@ -40,17 +51,17 @@ namespace cutl
struct basic_regex<C>::impl
{
typedef basic_string<C> string_type;
- typedef tr1::basic_regex<C> regex_type;
+ typedef ire::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 (tr1::regex_constants::ECMAScript);
+ flag_type f (ire::regex_constants::ECMAScript);
if (icase)
- f |= tr1::regex_constants::icase;
+ f |= ire::regex_constants::icase;
r.assign (s, f);
}
@@ -118,15 +129,15 @@ namespace cutl
impl_ = s == 0 ? new impl : new impl (*s, icase);
else
{
- impl::flag_type f (tr1::regex_constants::ECMAScript);
+ impl::flag_type f (ire::regex_constants::ECMAScript);
if (icase)
- f |= tr1::regex_constants::icase;
+ f |= ire::regex_constants::icase;
impl_->r.assign (*s, f);
}
}
- catch (tr1::regex_error const& e)
+ catch (ire::regex_error const& e)
{
throw basic_format<char> (s == 0 ? "" : *s, e.what ());
}
@@ -146,15 +157,15 @@ namespace cutl
impl_ = s == 0 ? new impl : new impl (*s, icase);
else
{
- impl::flag_type f (tr1::regex_constants::ECMAScript);
+ impl::flag_type f (ire::regex_constants::ECMAScript);
if (icase)
- f |= tr1::regex_constants::icase;
+ f |= ire::regex_constants::icase;
impl_->r.assign (*s, f);
}
}
- catch (tr1::regex_error const& e)
+ catch (ire::regex_error const& e)
{
throw basic_format<wchar_t> (s == 0 ? L"" : *s, e.what ());
}
@@ -166,28 +177,28 @@ namespace cutl
bool basic_regex<char>::
match (string_type const& s) const
{
- return tr1::regex_match (s, impl_->r);
+ return ire::regex_match (s, impl_->r);
}
template <>
bool basic_regex<wchar_t>::
match (string_type const& s) const
{
- return tr1::regex_match (s, impl_->r);
+ return ire::regex_match (s, impl_->r);
}
template <>
bool basic_regex<char>::
search (string_type const& s) const
{
- return tr1::regex_search (s, impl_->r);
+ return ire::regex_search (s, impl_->r);
}
template <>
bool basic_regex<wchar_t>::
search (string_type const& s) const
{
- return tr1::regex_search (s, impl_->r);
+ return ire::regex_search (s, impl_->r);
}
template <>
@@ -196,13 +207,13 @@ namespace cutl
string_type const& sub,
bool first_only) const
{
- tr1::regex_constants::match_flag_type f (
- tr1::regex_constants::format_default);
+ ire::regex_constants::match_flag_type f (
+ ire::regex_constants::format_default);
if (first_only)
- f |= tr1::regex_constants::format_first_only;
+ f |= ire::regex_constants::format_first_only;
- return tr1::regex_replace (s, impl_->r, sub, f);
+ return ire::regex_replace (s, impl_->r, sub, f);
}
template <>
@@ -211,13 +222,13 @@ namespace cutl
string_type const& sub,
bool first_only) const
{
- tr1::regex_constants::match_flag_type f (
- tr1::regex_constants::format_default);
+ ire::regex_constants::match_flag_type f (
+ ire::regex_constants::format_default);
if (first_only)
- f |= tr1::regex_constants::format_first_only;
+ f |= ire::regex_constants::format_first_only;
- return tr1::regex_replace (s, impl_->r, sub, f);
+ return ire::regex_replace (s, impl_->r, sub, f);
}
}
}
diff --git a/cutl/shared-ptr/base.cxx b/cutl/shared-ptr/base.cxx
index 1ff8469..4541e39 100644
--- a/cutl/shared-ptr/base.cxx
+++ b/cutl/shared-ptr/base.cxx
@@ -16,7 +16,7 @@ cutl::share exclusive = cutl::share (2);
namespace cutl
{
char const* not_shared::
- what () const throw ()
+ what () const LIBCUTL_NOTHROW_NOEXCEPT
{
return "object is not shared";
}
@@ -25,7 +25,10 @@ namespace cutl
//
//
void*
-operator new (size_t n, cutl::share s) throw (std::bad_alloc)
+operator new (size_t n, cutl::share s)
+#ifndef LIBCUTL_CXX11
+ throw (std::bad_alloc)
+#endif
{
if (s == shared)
{
@@ -45,7 +48,7 @@ operator new (size_t n, cutl::share s) throw (std::bad_alloc)
}
void
-operator delete (void* p, cutl::share s) throw ()
+operator delete (void* p, cutl::share s) LIBCUTL_NOTHROW_NOEXCEPT
{
// This version of operator delete is only called when the c-tor
// fails. In this case there is no object and we can just free the
diff --git a/cutl/shared-ptr/base.hxx b/cutl/shared-ptr/base.hxx
index f2bfecc..5eb1032 100644
--- a/cutl/shared-ptr/base.hxx
+++ b/cutl/shared-ptr/base.hxx
@@ -10,11 +10,12 @@
#include <cutl/exception.hxx>
+#include <cutl/details/config.hxx>
#include <cutl/details/export.hxx>
namespace cutl
{
- struct LIBCUTL_EXPORT share
+ struct share
{
explicit
share (char id);
@@ -30,18 +31,23 @@ namespace cutl
extern LIBCUTL_EXPORT cutl::share shared;
extern LIBCUTL_EXPORT cutl::share exclusive;
+#ifdef LIBCUTL_CXX11
+LIBCUTL_EXPORT void*
+operator new (std::size_t, cutl::share);
+#else
LIBCUTL_EXPORT void*
operator new (std::size_t, cutl::share) throw (std::bad_alloc);
+#endif
LIBCUTL_EXPORT void
-operator delete (void*, cutl::share) throw ();
+operator delete (void*, cutl::share) LIBCUTL_NOTHROW_NOEXCEPT;
namespace cutl
{
struct LIBCUTL_EXPORT not_shared: exception
{
virtual char const*
- what () const throw ();
+ what () const LIBCUTL_NOTHROW_NOEXCEPT;
};
struct LIBCUTL_EXPORT shared_base
@@ -60,14 +66,19 @@ namespace cutl
std::size_t
_ref_count () const;
+#ifdef LIBCUTL_CXX11
+ void*
+ operator new (std::size_t, share);
+#else
void*
operator new (std::size_t, share) throw (std::bad_alloc);
+#endif
void
- operator delete (void*, share) throw ();
+ operator delete (void*, share) LIBCUTL_NOTHROW_NOEXCEPT;
void
- operator delete (void*) throw ();
+ operator delete (void*) LIBCUTL_NOTHROW_NOEXCEPT;
protected:
std::size_t counter_;
diff --git a/cutl/shared-ptr/base.ixx b/cutl/shared-ptr/base.ixx
index 14dd0ac..3dd982b 100644
--- a/cutl/shared-ptr/base.ixx
+++ b/cutl/shared-ptr/base.ixx
@@ -59,19 +59,22 @@ namespace cutl
}
inline void* shared_base::
- operator new (std::size_t n, share) throw (std::bad_alloc)
+ operator new (std::size_t n, share)
+#ifndef LIBCUTL_CXX11
+ throw (std::bad_alloc)
+#endif
{
return ::operator new (n);
}
inline void shared_base::
- operator delete (void* p, share) throw ()
+ operator delete (void* p, share) LIBCUTL_NOTHROW_NOEXCEPT
{
::operator delete (p);
}
inline void shared_base::
- operator delete (void* p) throw ()
+ operator delete (void* p) LIBCUTL_NOTHROW_NOEXCEPT
{
::operator delete (p);
}