Alistair Leslie-Hughes : include: Add COM_DECLSPEC_NOTHROW define.

Alexandre Julliard julliard at winehq.org
Fri Oct 18 14:01:14 CDT 2019


Module: wine
Branch: master
Commit: 2ef00173e1d770b336597f9618f8272cefec727b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2ef00173e1d770b336597f9618f8272cefec727b

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Fri Oct 18 02:48:15 2019 +0000

include: Add COM_DECLSPEC_NOTHROW define.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/basetyps.h | 11 +++++++++--
 include/objbase.h  | 14 ++++++++++----
 include/winnt.h    | 10 ++++++++++
 3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/include/basetyps.h b/include/basetyps.h
index 94875334b0..82b25b7a17 100644
--- a/include/basetyps.h
+++ b/include/basetyps.h
@@ -40,9 +40,16 @@
 #define STDMETHODIMPV_(t)  t STDMETHODVCALLTYPE
 
 #if defined(__cplusplus) && !defined(CINTERFACE)
+
+#ifdef COM_STDMETHOD_CAN_THROW
+# define COM_DECLSPEC_NOTHROW
+#else
+# define COM_DECLSPEC_NOTHROW DECLSPEC_NOTHROW
+#endif
+
 # define interface struct
-# define STDMETHOD(m) virtual HRESULT STDMETHODCALLTYPE m
-# define STDMETHOD_(t,m) virtual t STDMETHODCALLTYPE m
+# define STDMETHOD(m)    virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE m
+# define STDMETHOD_(t,m) virtual COM_DECLSPEC_NOTHROW t STDMETHODCALLTYPE m
 # define PURE =0
 # define THIS_
 # define THIS void
diff --git a/include/objbase.h b/include/objbase.h
index a241b71199..78ec6d366d 100644
--- a/include/objbase.h
+++ b/include/objbase.h
@@ -172,12 +172,18 @@
 
 #if defined(__cplusplus) && !defined(CINTERFACE)
 
+#ifdef COM_STDMETHOD_CAN_THROW
+# define COM_DECLSPEC_NOTHROW
+#else
+# define COM_DECLSPEC_NOTHROW DECLSPEC_NOTHROW
+#endif
+
 /* C++ interface */
 
-#define STDMETHOD(method)        virtual HRESULT STDMETHODCALLTYPE method
-#define STDMETHOD_(type,method)  virtual type STDMETHODCALLTYPE method
-#define STDMETHODV(method)       virtual HRESULT STDMETHODVCALLTYPE method
-#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
+#define STDMETHOD(method)        virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE method
+#define STDMETHOD_(type,method)  virtual COM_DECLSPEC_NOTHROW type STDMETHODCALLTYPE method
+#define STDMETHODV(method)       virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODVCALLTYPE method
+#define STDMETHODV_(type,method) virtual COM_DECLSPEC_NOTHROW type STDMETHODVCALLTYPE method
 
 #define PURE   = 0
 #define THIS_
diff --git a/include/winnt.h b/include/winnt.h
index 3f59bd9f30..9c39eb7e4d 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -76,6 +76,16 @@ extern "C" {
 # endif
 #endif
 
+#ifndef DECLSPEC_NOTHROW
+# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
+#  define DECLSPEC_NOTHROW __declspec(nothrow)
+# elif defined(__GNUC__)
+#  define DECLSPEC_NOTHROW __attribute__((nothrow))
+# else
+#  define DECLSPEC_NOTHROW
+# endif
+#endif
+
 #ifndef DECLSPEC_CACHEALIGN
 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
 #endif




More information about the wine-cvs mailing list