]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxNOEXCEPT and use it for std::streambuf-derived classes.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 17 Nov 2012 23:56:23 +0000 (23:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 17 Nov 2012 23:56:23 +0000 (23:56 +0000)
This fixes warnings from Intel compiler about overriding function using a
different exception specification than the base one and also incidentally
provides a handy macro that can be useful in other situations.

Closes #14826.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/defs.h
include/wx/msw/textctrl.h
include/wx/stdstream.h
include/wx/textctrl.h
interface/wx/defs.h
src/common/combocmn.cpp
src/generic/spinctlg.cpp

index 0612f427a58cde26ea433d2da5ce6abe1f32cd37..66038b48770952700094c016361f016aafc4d86b 100644 (file)
@@ -550,6 +550,7 @@ All:
 - Add wxFile::ReadAll() for consistency with wxFFile.
 - Add wxDateTime::DiffAsDateSpan() and wxDateSpan::GetTotalMonths() (jonasr).
 - Add wxVector::assign() (Jonas Rydberg).
+- Add wxNOEXCEPT (Marian VooDooMan Meravy).
 - Added Nepali translation (Him Prasad Gautam).
 
 All (GUI):
index a96a6e91f442a5dae5ddded636ed76286a59a90d..a3a08d026fc690f88610e1c7c976a3f2d8e578fd 100644 (file)
@@ -3335,6 +3335,17 @@ typedef const void* WXWidget;
 #define DECLARE_NO_ASSIGN_CLASS(classname) \
     wxDECLARE_NO_ASSIGN_CLASS(classname);
 
+/* Macro that can be used to indicate that a function doesn't throw. */
+#if defined(__cplusplus) && __cplusplus >= 199711L /* C++98 */
+#   if __cplusplus >= 201103L /* >= C++11 */
+#       define wxNOEXCEPT   noexcept
+#   else
+#       define wxNOEXCEPT   throw()
+#   endif
+#else
+#   define wxNOEXCEPT
+#endif
+
 /*  --------------------------------------------------------------------------- */
 /*  If a manifest is being automatically generated, add common controls 6 to it */
 /*  --------------------------------------------------------------------------- */
index c56bcae45aad84d51edb206d6de3da67e0746896..f80eef03b215559ed18de1421dcbf9991934dde8 100644 (file)
@@ -31,7 +31,7 @@ public:
 
         Create(parent, id, value, pos, size, style, validator, name);
     }
-    virtual ~wxTextCtrl();
+    virtual ~wxTextCtrl() wxNOEXCEPT;
 
     bool Create(wxWindow *parent, wxWindowID id,
                 const wxString& value = wxEmptyString,
index 27d48d5c8b02a4f1069ab17f48be4d1d4a2e80da..cc65cc34f134395e593c01129d0088505e13c7ac 100644 (file)
@@ -28,7 +28,7 @@ class WXDLLIMPEXP_BASE wxStdInputStreamBuffer : public std::streambuf
 {
 public:
     wxStdInputStreamBuffer(wxInputStream& stream);
-    virtual ~wxStdInputStreamBuffer() { }
+    virtual ~wxStdInputStreamBuffer() wxNOEXCEPT { }
 
 protected:
     virtual std::streambuf *setbuf(char *s, std::streamsize n);
@@ -71,7 +71,7 @@ class WXDLLIMPEXP_BASE wxStdInputStream : public std::istream
 {
 public:
     wxStdInputStream(wxInputStream& stream);
-    virtual ~wxStdInputStream() { }
+    virtual ~wxStdInputStream() wxNOEXCEPT { }
 
 protected:
     wxStdInputStreamBuffer m_streamBuffer;
@@ -85,7 +85,7 @@ class WXDLLIMPEXP_BASE wxStdOutputStreamBuffer : public std::streambuf
 {
 public:
     wxStdOutputStreamBuffer(wxOutputStream& stream);
-    virtual ~wxStdOutputStreamBuffer() { }
+    virtual ~wxStdOutputStreamBuffer() wxNOEXCEPT { }
 
 protected:
     virtual std::streambuf *setbuf(char *s, std::streamsize n);
@@ -112,7 +112,7 @@ class WXDLLIMPEXP_BASE wxStdOutputStream : public std::ostream
 {
 public:
     wxStdOutputStream(wxOutputStream& stream);
-    virtual ~wxStdOutputStream() { }
+    virtual ~wxStdOutputStream() wxNOEXCEPT { }
 
 protected:
     wxStdOutputStreamBuffer m_streamBuffer;
index d4780cc98747f84d0107b21fba41e3a6167749fb..dcf0311b74f945f2bd2be0f8ec9a3158f3d9ea94 100644 (file)
@@ -679,7 +679,7 @@ public:
     // --------
 
     wxTextCtrlBase() { }
-    virtual ~wxTextCtrlBase() { }
+    virtual ~wxTextCtrlBase() wxNOEXCEPT { }
 
 
     // more readable flag testing methods
index 0c310f10d2929f1196def7cc921c5fecb86b23db..43b41fb971359d61232f702e9bd6954258341d39 100644 (file)
@@ -1725,6 +1725,22 @@ template <typename T> wxSwap(T& first, T& second);
 */
 void wxVaCopy(va_list argptrDst, va_list argptrSrc);
 
+/**
+    Macro that can be used to indicate that a function doesn't throw any
+    exceptions.
+
+    This macro expands to `noexcept` when using C++11 compiler or `throw()` for
+    older C++ compilers or nothing when used with a C++ compiler too old to
+    support even this.
+
+    Notice that `noexcept` and `throw()` have different semantics in case an
+    exception @e is thrown, so this macro should be used only if you don't rely
+    on the behaviour provided by the latter but not the former.
+
+    @since 2.9.5
+ */
+#define wxNOEXCEPT
+
 //@}
 
 
index ac476a5addc1005245937e3a8e7ff86daed3fd6b..d8d2915f10b2204c2fbe7c5926fc3a82b9d9f190 100644 (file)
@@ -940,7 +940,7 @@ class wxComboCtrlTextCtrl : public wxTextCtrl
 {
 public:
     wxComboCtrlTextCtrl() : wxTextCtrl() { }
-    virtual ~wxComboCtrlTextCtrl() { }
+    virtual ~wxComboCtrlTextCtrl() wxNOEXCEPT { }
 
     virtual wxWindow *GetMainWindowOfCompositeControl()
     {
index 64d00b43ffa7e05542077dae0d069d2998d18ef5..f602d8ded544f364d369a54090caf731e4db01a4 100644 (file)
@@ -77,7 +77,7 @@ public:
         SetSizeHints(wxDefaultCoord, wxDefaultCoord);
     }
 
-    virtual ~wxSpinCtrlTextGeneric()
+    virtual ~wxSpinCtrlTextGeneric() wxNOEXCEPT
     {
         // MSW sends extra kill focus event on destroy
         if (m_spin)