Ben Wagner | 6cb6a07 | 2019-08-12 18:30:27 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkObjBase_DEFINED |
| 9 | #define SkObjBase_DEFINED |
| 10 | |
| 11 | #include "src/core/SkLeanWindows.h" |
| 12 | #include <objbase.h> |
| 13 | |
| 14 | // STDMETHOD uses COM_DECLSPEC_NOTHROW, but STDMETHODIMP does not. This leads to attribute mismatch |
| 15 | // between interfaces and implementations which produces warnings. In theory a COM component should |
| 16 | // never throw a c++ exception, but COM_DECLSPEC_NOTHROW allows tweaking that (as it may be useful |
| 17 | // for internal only implementations within a single project). The behavior of the attribute nothrow |
| 18 | // and the keyword noexcept are slightly different, so use COM_DECLSPEC_NOTHROW instead of noexcept. |
| 19 | // Older interfaces like IUnknown and IStream do not currently specify COM_DECLSPEC_NOTHROW, but it |
| 20 | // is not harmful to mark the implementation more exception strict than the interface. |
| 21 | |
| 22 | #define SK_STDMETHODIMP COM_DECLSPEC_NOTHROW STDMETHODIMP |
| 23 | #define SK_STDMETHODIMP_(type) COM_DECLSPEC_NOTHROW STDMETHODIMP_(type) |
| 24 | |
| 25 | #endif |