Nicola Mazzucato | 64f57d7 | 2024-06-24 12:13:22 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2024, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | #ifndef __TFM_PRIV_ASSERT_H__ |
| 8 | #define __TFM_PRIV_ASSERT_H__ |
| 9 | |
| 10 | #include <string.h> |
| 11 | #include "tfm_spm_log.h" |
| 12 | |
| 13 | #ifndef NDEBUG |
| 14 | #define SPM_ASSERT(cond) \ |
| 15 | do { \ |
| 16 | if (!(cond)) { \ |
| 17 | SPMLOG_INFMSG("Assert:"); \ |
| 18 | SPMLOG_INFMSG(__func__); \ |
| 19 | SPMLOG_INFMSGVAL(",", __LINE__); \ |
| 20 | while (1) { \ |
| 21 | ; \ |
| 22 | } \ |
| 23 | } \ |
| 24 | } while (0) |
| 25 | #else |
| 26 | #define SPM_ASSERT(cond) |
| 27 | #endif |
| 28 | |
| 29 | #define assert(cond) SPM_ASSERT(cond) |
| 30 | |
| 31 | #endif /* __TFM_PRIV_ASSERT_H__ */ |