geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
geopm_debug.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef GEOPM_DEBUG_HPP_INCLUDE
7 #define GEOPM_DEBUG_HPP_INCLUDE
8 
9 #include "geopm/Exception.hpp"
10 #include "geopm_public.h"
11 
12 #ifdef GEOPM_DEBUG
16 #define GEOPM_DEBUG_ASSERT(condition, fail_message) \
17  if (!(condition)) { \
18  throw Exception(std::string(__func__) + ": " + fail_message, \
19  GEOPM_ERROR_LOGIC, __FILE__, __LINE__); \
20  }
21 #else
22 #define GEOPM_DEBUG_ASSERT(condition, fail_message)
23 #endif
24 
25 #endif