From 6d434f6600c5ecf99c813fedfb57163ff79321ec Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 26 Nov 2020 06:46:07 -0600 Subject: [PATCH 1/2] fix warning #50 --- backends/source/dppl_sycl_context_interface.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backends/source/dppl_sycl_context_interface.cpp b/backends/source/dppl_sycl_context_interface.cpp index 78c71f5ad0..5f5b4ff54a 100644 --- a/backends/source/dppl_sycl_context_interface.cpp +++ b/backends/source/dppl_sycl_context_interface.cpp @@ -47,7 +47,11 @@ bool DPPLContext_AreEq (__dppl_keep const DPPLSyclContextRef CtxRef1, bool DPPLContext_IsHost (__dppl_keep const DPPLSyclContextRef CtxRef) { - return unwrap(CtxRef)->is_host(); + auto Ctx = unwrap(CtxRef) + if (Ctx) { + return Ctx->is_host(); + } + return false; } void DPPLContext_Delete (__dppl_take DPPLSyclContextRef CtxRef) From 1d3e887983cdc3af5316af4b06f4a4831aa4ca12 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 30 Nov 2020 04:47:26 -0600 Subject: [PATCH 2/2] fix warnings #42 and #50 --- backends/source/dppl_sycl_context_interface.cpp | 2 +- backends/source/dppl_sycl_platform_interface.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backends/source/dppl_sycl_context_interface.cpp b/backends/source/dppl_sycl_context_interface.cpp index 5f5b4ff54a..c160d72065 100644 --- a/backends/source/dppl_sycl_context_interface.cpp +++ b/backends/source/dppl_sycl_context_interface.cpp @@ -47,7 +47,7 @@ bool DPPLContext_AreEq (__dppl_keep const DPPLSyclContextRef CtxRef1, bool DPPLContext_IsHost (__dppl_keep const DPPLSyclContextRef CtxRef) { - auto Ctx = unwrap(CtxRef) + auto Ctx = unwrap(CtxRef); if (Ctx) { return Ctx->is_host(); } diff --git a/backends/source/dppl_sycl_platform_interface.cpp b/backends/source/dppl_sycl_platform_interface.cpp index 89b1377fa8..2e68c56823 100644 --- a/backends/source/dppl_sycl_platform_interface.cpp +++ b/backends/source/dppl_sycl_platform_interface.cpp @@ -148,7 +148,12 @@ size_t DPPLPlatform_GetNumNonHostPlatforms () size_t DPPLPlatform_GetNumNonHostBackends () { - return get_set_of_non_hostbackends().size(); + auto be_set = get_set_of_non_hostbackends(); + + if (be_set.empty()) + return 0; + + return be_set.size(); } __dppl_give DPPLSyclBackendType *DPPLPlatform_GetListOfNonHostBackends ()