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
(cherry picked from commit 9f87197d8d)
Esse commit está contido em:
Laurent Morichetti
2022-01-19 19:43:45 +00:00
commit de Harish Kasiviswanathan
commit 2804bf7c28
3 arquivos alterados com 4 adições e 4 exclusões
+1 -1
Ver Arquivo
@@ -485,7 +485,7 @@ static const std::map<const char *, dev_depends_t> 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
+2 -2
Ver Arquivo
@@ -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;
+1 -1
Ver Arquivo
@@ -279,7 +279,7 @@ static const std::map<const char *, monitor_depends_t> kMonFuncDependsMap = {
Monitor::Monitor(std::string path, RocmSMI_env_vars const *e) :
path_(path), env_(e) {
#ifdef NDEBUG
#ifndef DEBUG
env_ = nullptr;
#endif
}