From 3b5b0175acaa573f84148c35f3c1f92bb0a8678a Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Sat, 16 Jan 2021 11:49:03 -0500 Subject: [PATCH] Fix build error when building with clang++ Change-Id: If1c9fbd6af6028bd39ff43ee53d74d5e778e2a27 [ROCm/clr commit: c0730b69d5a662be870338dbba738099af820e2d] --- projects/clr/rocclr/device/device.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/projects/clr/rocclr/device/device.hpp b/projects/clr/rocclr/device/device.hpp index 3850b6cf91..316ddf4cb6 100644 --- a/projects/clr/rocclr/device/device.hpp +++ b/projects/clr/rocclr/device/device.hpp @@ -37,6 +37,7 @@ #include "acl.h" #include "hwdebug.hpp" +#include #include #include #include @@ -1255,9 +1256,9 @@ class Isa { //! Return a non-zero uint64_t value that uniquely identifies the device. //! This can be used when a scalar value handle to the device is require. static uint64_t toHandle(const Isa *isa) { - static_assert(reinterpret_cast(static_cast(nullptr)) == 0, - "nullptr value is not 0"); static_assert(sizeof(isa) <= sizeof(uint64_t), "Handle size does not match pointer size"); + assert((reinterpret_cast(static_cast(nullptr)) == 0) && + "nullptr value is not 0"); return isa ? reinterpret_cast(isa) : 0; } @@ -1265,9 +1266,9 @@ class Isa { //! or nullptr if the handle is 0. This can be used when a scalar value //! handle for a device is provided. static const Isa* fromHandle(uint64_t handle) { - static_assert(reinterpret_cast(static_cast(nullptr)) == 0, - "nullptr value is not 0"); static_assert(sizeof(handle) <= sizeof(uint64_t), "Handle size does not match pointer size"); + assert((reinterpret_cast(static_cast(nullptr)) == 0) && + "nullptr value is not 0"); return handle ? reinterpret_cast(handle) : nullptr; } @@ -1695,9 +1696,9 @@ class Device : public RuntimeObject { //! Return a non-zero uint64_t value that uniquely identifies the device. //! This can be used when a scalar value handle to the device is require. static uint64_t toHandle(const Device *device) { - static_assert(reinterpret_cast(static_cast(nullptr)) == 0, - "nullptr value is not 0"); static_assert(sizeof(device) <= sizeof(uint64_t), "Handle size does not match pointer size"); + assert((reinterpret_cast(static_cast(nullptr)) == 0) && + "nullptr value is not 0"); return device ? reinterpret_cast(device) : 0; } @@ -1705,9 +1706,9 @@ class Device : public RuntimeObject { //! or nullptr if the handle is 0. This can be used when a scalar value //! handle for a device is provided. static const Device* fromHhandle(uint64_t handle) { - static_assert(reinterpret_cast(static_cast(nullptr)) == 0, - "nullptr value is not 0"); static_assert(sizeof(handle) <= sizeof(uint64_t), "Handle size does not match pointer size"); + assert((reinterpret_cast(static_cast(nullptr)) == 0) && + "nullptr value is not 0"); return handle ? reinterpret_cast(handle) : nullptr; }