diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-05-07 12:17:35 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-05-07 12:17:35 +0800 |
commit | c4392f49d1313fbc159882e993683909ea40f188 (patch) | |
tree | 9cf0cefe1cd7af64bd548718d99bbd95a15918f6 | |
parent | 1c9772fc78d6ee308eb2ed70e996a0fd8a410976 (diff) | |
download | glibmm-c4392f49d1313fbc159882e993683909ea40f188.tar.gz |
error.h Avoid exporting class deriving frm std::exception
This will avoid having the ABI tied to a particular STL and compiler version,
and so will eliminate C4275 compiler warnings when building the code.
Also update gerror.m4 so that it will generate code deriving from Glib::Error
with the export macro markings with the member functions, so that things
continue to build properly
-rw-r--r-- | glib/glibmm/error.h | 38 | ||||
-rw-r--r-- | tools/m4/gerror.m4 | 10 |
2 files changed, 24 insertions, 24 deletions
diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h index 19e37416..13bbb683 100644 --- a/glib/glibmm/error.h +++ b/glib/glibmm/error.h @@ -25,44 +25,44 @@ namespace Glib { -class GLIBMM_API Error : public std::exception +class Error : public std::exception { public: - Error(); - Error(GQuark error_domain, int error_code, const Glib::ustring& message); - explicit Error(GError* gobject, bool take_copy = false); + GLIBMM_API Error(); + GLIBMM_API Error(GQuark error_domain, int error_code, const Glib::ustring& message); + GLIBMM_API explicit Error(GError* gobject, bool take_copy = false); - Error(const Error& other); - Error& operator=(const Error& other); + GLIBMM_API Error(const Error& other); + GLIBMM_API Error& operator=(const Error& other); - ~Error() noexcept override; + GLIBMM_API ~Error() noexcept override; /** Test whether the %Error has an underlying instance. * * @newin{2,60} */ - explicit operator bool() const; + GLIBMM_API explicit operator bool() const; - GQuark domain() const; - int code() const; - const char* what() const noexcept override; + GLIBMM_API GQuark domain() const; + GLIBMM_API int code() const; + GLIBMM_API const char* what() const noexcept override; - bool matches(GQuark error_domain, int error_code) const; + GLIBMM_API bool matches(GQuark error_domain, int error_code) const; - GError* gobj(); - const GError* gobj() const; + GLIBMM_API GError* gobj(); + GLIBMM_API const GError* gobj() const; #ifndef DOXYGEN_SHOULD_SKIP_THIS - void propagate(GError** dest); + GLIBMM_API void propagate(GError** dest); using ThrowFunc = void(*)(GError*); - static void register_init(); - static void register_cleanup(); - static void register_domain(GQuark error_domain, ThrowFunc throw_func); + GLIBMM_API static void register_init(); + GLIBMM_API static void register_cleanup(); + GLIBMM_API static void register_domain(GQuark error_domain, ThrowFunc throw_func); - static void throw_exception(GError* gobject) G_GNUC_NORETURN; + GLIBMM_API static void throw_exception(GError* gobject) G_GNUC_NORETURN; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4 index 4dabb037..01036f06 100644 --- a/tools/m4/gerror.m4 +++ b/tools/m4/gerror.m4 @@ -17,7 +17,7 @@ ifelse(`$6',,,`dnl /** $6 */ ')dnl -class $9 __CPPNAME__ : public Glib::Error +class __CPPNAME__ : public Glib::Error { public: /** $7 @@ -27,14 +27,14 @@ public: $4 }; - __CPPNAME__`'(Code error_code, const Glib::ustring& error_message); - explicit __CPPNAME__`'(GError* gobject); - Code code() const; + $9 __CPPNAME__`'(Code error_code, const Glib::ustring& error_message); + $9 explicit __CPPNAME__`'(GError* gobject); + $9 Code code() const; #ifndef DOXYGEN_SHOULD_SKIP_THIS private: - static void throw_func(GError* gobject); + $9 static void throw_func(GError* gobject); friend $9 void wrap_init(); // uses throw_func() |