summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qfunctions_winrt.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-11-07 14:59:28 -0800
committerThiago Macieira <thiago.macieira@intel.com>2014-12-01 21:37:24 +0100
commit2bfc010b83974776f03fee011f5b2ab815fdbc2e (patch)
tree5308bf562180491709b6ce45362946469c9a7c97 /src/corelib/kernel/qfunctions_winrt.h
parentfe6f4b9ad7eff15e6201baea9dad737c792a328c (diff)
Un-tighten the WinRT specific code out of qfunctions_winrt.h
Keep the WinRT specific parts for WinRT only. This commit is a partial reversal of 67c83f329e7fb6fbf5d8e402f42ea8916c34f01c "Tighten Q_OS_WINRT ifdefs in qfunctions_winrt.h", which let the WinRT definitions out too wide. Strictly speaking, the C++ code that uses Microsoft::WRL::ComPtr<IAsyncInfo> without the #include is broken. The forward definition is not enough, but since Visual Studio is also broken, two wrongs made a right... (MSVC does not implement two-stage parsing of template code properly). But if you accidentally tried to compile qfunctions_winrt.h with a non-broken compiler, like GCC (MinGW), it would correctly complain. Change-Id: I7591015861d291a82050afe0f4df0cb18b43e23d Reviewed-by: Andrew Knight <andrew.knight@theqtcompany.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Diffstat (limited to 'src/corelib/kernel/qfunctions_winrt.h')
-rw-r--r--src/corelib/kernel/qfunctions_winrt.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h
index 04ebda5cfe..c8e082795e 100644
--- a/src/corelib/kernel/qfunctions_winrt.h
+++ b/src/corelib/kernel/qfunctions_winrt.h
@@ -42,6 +42,23 @@
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/qt_windows.h>
+// Convenience macros for handling HRESULT values
+#define RETURN_IF_FAILED(msg, ret) \
+ if (FAILED(hr)) { \
+ qErrnoWarning(hr, msg); \
+ ret; \
+ }
+
+#define RETURN_HR_IF_FAILED(msg) RETURN_IF_FAILED(msg, return hr)
+#define RETURN_OK_IF_FAILED(msg) RETURN_IF_FAILED(msg, return S_OK)
+#define RETURN_FALSE_IF_FAILED(msg) RETURN_IF_FAILED(msg, return false)
+#define RETURN_VOID_IF_FAILED(msg) RETURN_IF_FAILED(msg, return)
+
+#define Q_ASSERT_SUCCEEDED(hr) \
+ Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr)));
+
+#ifdef Q_OS_WINRT
+
QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_CORE_LIB
@@ -49,7 +66,6 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
-#ifdef Q_OS_WINRT
// Environment ------------------------------------------------------
errno_t qt_winrt_getenv_s(size_t*, char*, size_t, const char*);
@@ -116,24 +132,6 @@ generate_inline_return_func2(_putenv_s, errno_t, const char *, const char *)
generate_inline_return_func0(tzset, void)
generate_inline_return_func0(_tzset, void)
-#endif // Q_OS_WINRT
-
-// Convenience macros for handling HRESULT values
-#define RETURN_IF_FAILED(msg, ret) \
- if (FAILED(hr)) { \
- qErrnoWarning(hr, msg); \
- ret; \
- }
-
-#define RETURN_HR_IF_FAILED(msg) RETURN_IF_FAILED(msg, return hr)
-#define RETURN_OK_IF_FAILED(msg) RETURN_IF_FAILED(msg, return S_OK)
-#define RETURN_FALSE_IF_FAILED(msg) RETURN_IF_FAILED(msg, return false)
-#define RETURN_VOID_IF_FAILED(msg) RETURN_IF_FAILED(msg, return)
-
-#define Q_ASSERT_SUCCEEDED(hr) \
- Q_ASSERT_X(SUCCEEDED(hr), Q_FUNC_INFO, qPrintable(qt_error_string(hr)));
-
-
namespace Microsoft { namespace WRL { template <typename T> class ComPtr; } }
namespace QWinRTFunctions {
@@ -207,6 +205,8 @@ static inline HRESULT await(const Microsoft::WRL::ComPtr<T> &asyncOp, U *results
} // QWinRTFunctions
+#endif // Q_OS_WINRT
+
#endif // Q_OS_WIN
#endif // QFUNCTIONS_WINRT_H