From f430cd4f9178f1423ccc74d07b263f484e3930cc Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Wed, 19 Jan 2022 19:43:45 +0000 Subject: [PATCH] Don't use NDEBUG when the intent is !DEBUG CMakeLists.txt does not set up the DEBUG macro correctly to mean !NDEBUG, so, as a workaround, replace all uses of ifdef NDEBUG with ifndef DEBUG in the library sources. Change-Id: I408adb36d1a2310fb894a486574469662ebb27cd [ROCm/rocm_smi_lib commit: 9f87197d8db14e32474b298693438ba7ca863b72] --- projects/rocm-smi-lib/src/rocm_smi_device.cc | 2 +- projects/rocm-smi-lib/src/rocm_smi_main.cc | 4 ++-- projects/rocm-smi-lib/src/rocm_smi_monitor.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/rocm-smi-lib/src/rocm_smi_device.cc b/projects/rocm-smi-lib/src/rocm_smi_device.cc index 51e6782263..0caf7f2426 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_device.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_device.cc @@ -485,7 +485,7 @@ static const std::map kDevFuncDependsMap = { Device::Device(std::string p, RocmSMI_env_vars const *e) : monitor_(nullptr), path_(p), env_(e), evt_notif_anon_fd_(-1), gpu_metrics_ver_{0, 0, 0} { -#ifdef NDEBUG +#ifndef DEBUG env_ = nullptr; #endif diff --git a/projects/rocm-smi-lib/src/rocm_smi_main.cc b/projects/rocm-smi-lib/src/rocm_smi_main.cc index d760d55171..171fc9d803 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_main.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_main.cc @@ -341,7 +341,7 @@ RocmSMI& RocmSMI::getInstance(uint64_t flags) { } static uint32_t GetEnvVarUInteger(const char *ev_str) { -#ifdef NDEBUG +#ifndef DEBUG (void)ev_str; #else ev_str = getenv(ev_str); @@ -357,7 +357,7 @@ static uint32_t GetEnvVarUInteger(const char *ev_str) { // Get and store env. variables in this method void RocmSMI::GetEnvVariables(void) { -#ifdef NDEBUG +#ifndef DEBUG (void)GetEnvVarUInteger(nullptr); // This is to quiet release build warning. env_vars_.debug_output_bitfield = 0; env_vars_.path_DRM_root_override = nullptr; diff --git a/projects/rocm-smi-lib/src/rocm_smi_monitor.cc b/projects/rocm-smi-lib/src/rocm_smi_monitor.cc index 53659efe36..15c995ebae 100755 --- a/projects/rocm-smi-lib/src/rocm_smi_monitor.cc +++ b/projects/rocm-smi-lib/src/rocm_smi_monitor.cc @@ -279,7 +279,7 @@ static const std::map kMonFuncDependsMap = { Monitor::Monitor(std::string path, RocmSMI_env_vars const *e) : path_(path), env_(e) { -#ifdef NDEBUG +#ifndef DEBUG env_ = nullptr; #endif }