]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/std/stdexcept
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / include / std / stdexcept
index e049a6eecd84917eadab4b98df4d3fbdcfc14f9f..49161d5d0d2ff3fb0833a73a52edc6930cc5b255 100644 (file)
@@ -1,6 +1,6 @@
 // Standard exception classes  -*- C++ -*-
 
-// Copyright (C) 2001-2014 Free Software Foundation, Inc.
+// Copyright (C) 2001-2020 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -55,8 +55,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     __cow_string();
     __cow_string(const std::string&);
     __cow_string(const char*, size_t);
-    __cow_string(const __cow_string&) _GLIBCXX_USE_NOEXCEPT;
-    __cow_string& operator=(const __cow_string&) _GLIBCXX_USE_NOEXCEPT;
+    __cow_string(const __cow_string&) _GLIBCXX_NOTHROW;
+    __cow_string& operator=(const __cow_string&) _GLIBCXX_NOTHROW;
     ~__cow_string();
 #if __cplusplus >= 201103L
     __cow_string(__cow_string&&) noexcept;
@@ -80,10 +80,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
     union {
       __str _M_s;
-      char _M_bytes[sizeof(_M_s)];
+      char _M_bytes[sizeof(__str)];
     };
 
-    __sso_string() _GLIBCXX_USE_NOEXCEPT;
+    __sso_string() _GLIBCXX_NOTHROW;
     __sso_string(const std::string&);
     __sso_string(const char*, size_t);
     __sso_string(const __sso_string&);
@@ -110,78 +110,105 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  program runs (e.g., violations of class invariants).
    *  @brief One of two subclasses of exception.
    */
-  class logic_error : public exception 
+  class logic_error : public exception
   {
     __cow_string _M_msg;
 
   public:
     /** Takes a character string describing the error.  */
-    explicit 
-    logic_error(const string& __arg);
+    explicit
+    logic_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 
 #if __cplusplus >= 201103L
     explicit
-    logic_error(const char*);
+    logic_error(const char*) _GLIBCXX_TXN_SAFE;
+
+    logic_error(logic_error&&) noexcept;
+    logic_error& operator=(logic_error&&) noexcept;
 #endif
 
 #if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
-    logic_error(const logic_error&) _GLIBCXX_USE_NOEXCEPT;
-    logic_error& operator=(const logic_error&) _GLIBCXX_USE_NOEXCEPT;
+    logic_error(const logic_error&) _GLIBCXX_NOTHROW;
+    logic_error& operator=(const logic_error&) _GLIBCXX_NOTHROW;
+#elif __cplusplus >= 201103L
+    logic_error(const logic_error&) = default;
+    logic_error& operator=(const logic_error&) = default;
 #endif
 
-    virtual ~logic_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~logic_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
 
     /** Returns a C-style character string describing the general cause of
      *  the current error (the same string passed to the ctor).  */
-    virtual const char* 
-    what() const _GLIBCXX_USE_NOEXCEPT;
+    virtual const char*
+    what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
+
+# ifdef _GLIBCXX_TM_TS_INTERNAL
+    friend void*
+    ::_txnal_logic_error_get_msg(void* e);
+# endif
   };
 
   /** Thrown by the library, or by you, to report domain errors (domain in
    *  the mathematical sense).  */
-  class domain_error : public logic_error 
+  class domain_error : public logic_error
   {
   public:
-    explicit domain_error(const string& __arg);
+    explicit domain_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit domain_error(const char*);
+    explicit domain_error(const char*) _GLIBCXX_TXN_SAFE;
+    domain_error(const domain_error&) = default;
+    domain_error& operator=(const domain_error&) = default;
+    domain_error(domain_error&&) = default;
+    domain_error& operator=(domain_error&&) = default;
 #endif
-    virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~domain_error() _GLIBCXX_NOTHROW;
   };
 
   /** Thrown to report invalid arguments to functions.  */
-  class invalid_argument : public logic_error 
+  class invalid_argument : public logic_error
   {
   public:
-    explicit invalid_argument(const string& __arg);
+    explicit invalid_argument(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit invalid_argument(const char*);
+    explicit invalid_argument(const char*) _GLIBCXX_TXN_SAFE;
+    invalid_argument(const invalid_argument&) = default;
+    invalid_argument& operator=(const invalid_argument&) = default;
+    invalid_argument(invalid_argument&&) = default;
+    invalid_argument& operator=(invalid_argument&&) = default;
 #endif
-    virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~invalid_argument() _GLIBCXX_NOTHROW;
   };
 
   /** Thrown when an object is constructed that would exceed its maximum
    *  permitted size (e.g., a basic_string instance).  */
-  class length_error : public logic_error 
+  class length_error : public logic_error
   {
   public:
-    explicit length_error(const string& __arg);
+    explicit length_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit length_error(const char*);
+    explicit length_error(const char*) _GLIBCXX_TXN_SAFE;
+    length_error(const length_error&) = default;
+    length_error& operator=(const length_error&) = default;
+    length_error(length_error&&) = default;
+    length_error& operator=(length_error&&) = default;
 #endif
-    virtual ~length_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~length_error() _GLIBCXX_NOTHROW;
   };
 
   /** This represents an argument whose value is not within the expected
    *  range (e.g., boundary checks in basic_string).  */
-  class out_of_range : public logic_error 
+  class out_of_range : public logic_error
   {
   public:
-    explicit out_of_range(const string& __arg);
+    explicit out_of_range(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit out_of_range(const char*);
+    explicit out_of_range(const char*) _GLIBCXX_TXN_SAFE;
+    out_of_range(const out_of_range&) = default;
+    out_of_range& operator=(const out_of_range&) = default;
+    out_of_range(out_of_range&&) = default;
+    out_of_range& operator=(out_of_range&&) = default;
 #endif
-    virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~out_of_range() _GLIBCXX_NOTHROW;
   };
 
   /** Runtime errors represent problems outside the scope of a program;
@@ -189,64 +216,87 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *  the program executes.
    *  @brief One of two subclasses of exception.
    */
-  class runtime_error : public exception 
+  class runtime_error : public exception
   {
     __cow_string _M_msg;
 
   public:
     /** Takes a character string describing the error.  */
-    explicit 
-    runtime_error(const string& __arg);
+    explicit
+    runtime_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 
 #if __cplusplus >= 201103L
     explicit
-    runtime_error(const char*);
+    runtime_error(const char*) _GLIBCXX_TXN_SAFE;
+
+    runtime_error(runtime_error&&) noexcept;
+    runtime_error& operator=(runtime_error&&) noexcept;
 #endif
 
 #if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
-    runtime_error(const runtime_error&) _GLIBCXX_USE_NOEXCEPT;
-    runtime_error& operator=(const runtime_error&) _GLIBCXX_USE_NOEXCEPT;
+    runtime_error(const runtime_error&) _GLIBCXX_NOTHROW;
+    runtime_error& operator=(const runtime_error&) _GLIBCXX_NOTHROW;
+#elif __cplusplus >= 201103L
+    runtime_error(const runtime_error&) = default;
+    runtime_error& operator=(const runtime_error&) = default;
 #endif
 
-    virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~runtime_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
 
     /** Returns a C-style character string describing the general cause of
      *  the current error (the same string passed to the ctor).  */
-    virtual const char* 
-    what() const _GLIBCXX_USE_NOEXCEPT;
+    virtual const char*
+    what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW;
+
+# ifdef _GLIBCXX_TM_TS_INTERNAL
+    friend void*
+    ::_txnal_runtime_error_get_msg(void* e);
+# endif
   };
 
   /** Thrown to indicate range errors in internal computations.  */
-  class range_error : public runtime_error 
+  class range_error : public runtime_error
   {
   public:
-    explicit range_error(const string& __arg);
+    explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit range_error(const char*);
+    explicit range_error(const char*) _GLIBCXX_TXN_SAFE;
+    range_error(const range_error&) = default;
+    range_error& operator=(const range_error&) = default;
+    range_error(range_error&&) = default;
+    range_error& operator=(range_error&&) = default;
 #endif
-    virtual ~range_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~range_error() _GLIBCXX_NOTHROW;
   };
 
   /** Thrown to indicate arithmetic overflow.  */
-  class overflow_error : public runtime_error 
+  class overflow_error : public runtime_error
   {
   public:
-    explicit overflow_error(const string& __arg);
+    explicit overflow_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit overflow_error(const char*);
+    explicit overflow_error(const char*) _GLIBCXX_TXN_SAFE;
+    overflow_error(const overflow_error&) = default;
+    overflow_error& operator=(const overflow_error&) = default;
+    overflow_error(overflow_error&&) = default;
+    overflow_error& operator=(overflow_error&&) = default;
 #endif
-    virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~overflow_error() _GLIBCXX_NOTHROW;
   };
 
   /** Thrown to indicate arithmetic underflow.  */
-  class underflow_error : public runtime_error 
+  class underflow_error : public runtime_error
   {
   public:
-    explicit underflow_error(const string& __arg);
+    explicit underflow_error(const string& __arg) _GLIBCXX_TXN_SAFE;
 #if __cplusplus >= 201103L
-    explicit underflow_error(const char*);
+    explicit underflow_error(const char*) _GLIBCXX_TXN_SAFE;
+    underflow_error(const underflow_error&) = default;
+    underflow_error& operator=(const underflow_error&) = default;
+    underflow_error(underflow_error&&) = default;
+    underflow_error& operator=(underflow_error&&) = default;
 #endif
-    virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT;
+    virtual ~underflow_error() _GLIBCXX_NOTHROW;
   };
 
   // @} group exceptions