]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/std/system_error
New std::string implementation.
[thirdparty/gcc.git] / libstdc++-v3 / include / std / system_error
index ed17f554bca3744d12864616bd9767e0308efd2d..786445e1c53943d36ca06d479ea97d1e2bbe41be 100644 (file)
@@ -46,7 +46,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   class error_code;
   class error_condition;
-  class error_category;
   class system_error;
 
   /// is_error_code_enum
@@ -61,16 +60,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_error_condition_enum<errc>
     : public true_type { };
 
+  inline namespace _V2 {
 
   /// error_category
   class error_category
   {
   public:
-#ifdef _GLIBCXX_COMPATIBILITY_CXX0X
-    error_category() noexcept;
-#else
     constexpr error_category() noexcept = default;
-#endif
 
     virtual ~error_category();
 
@@ -80,9 +76,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     virtual const char* 
     name() const noexcept = 0;
 
+    // We need two different virtual functions here, one returning a
+    // COW string and one returning an SSO string. Their positions in the
+    // vtable must be consistent for dynamic dispatch to work, but which one
+    // the name "message()" finds depends on which ABI the caller is using.
+#if _GLIBCXX_USE_CXX11_ABI
+  private:
+    _GLIBCXX_DEFAULT_ABI_TAG
+    virtual __cow_string
+    _M_message(int) const;
+
+  public:
+    _GLIBCXX_DEFAULT_ABI_TAG
+    virtual string
+    message(int) const = 0;
+#else
     virtual string 
     message(int) const = 0;
 
+  private:
+    virtual __sso_string
+    _M_message(int) const;
+#endif
+
+  public:
     virtual error_condition
     default_error_condition(int __i) const noexcept;
 
@@ -109,6 +126,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   _GLIBCXX_CONST const error_category& system_category() noexcept;
   _GLIBCXX_CONST const error_category& generic_category() noexcept;
 
+  } // end inline namespace
+
   error_code make_error_code(errc) noexcept;
 
   template<typename _Tp>
@@ -156,6 +175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     error_condition 
     default_error_condition() const noexcept;
 
+    _GLIBCXX_DEFAULT_ABI_TAG
     string 
     message() const
     { return category().message(value()); }
@@ -231,6 +251,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     const error_category&
     category() const noexcept { return *_M_cat; }
 
+    _GLIBCXX_DEFAULT_ABI_TAG
     string 
     message() const
     { return category().message(value()); }