Nicola Mazzucato | 64f57d7 | 2024-06-24 12:13:22 +0100 | [diff] [blame] | 1 | /* |
Jackson Cooper-Driver | af54602 | 2025-03-13 15:14:27 +0000 | [diff] [blame^] | 2 | * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors |
Nicola Mazzucato | 64f57d7 | 2024-06-24 12:13:22 +0100 | [diff] [blame] | 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> |
Jackson Cooper-Driver | af54602 | 2025-03-13 15:14:27 +0000 | [diff] [blame^] | 11 | #include "tfm_log.h" |
Nicola Mazzucato | 64f57d7 | 2024-06-24 12:13:22 +0100 | [diff] [blame] | 12 | |
| 13 | #ifndef NDEBUG |
Jackson Cooper-Driver | af54602 | 2025-03-13 15:14:27 +0000 | [diff] [blame^] | 14 | #define SPM_ASSERT(cond) \ |
| 15 | do { \ |
| 16 | if (!(cond)) { \ |
| 17 | INFO_RAW("Assert: %s, %d\n", __func__, __LINE__); \ |
| 18 | while (1) { \ |
| 19 | ; \ |
| 20 | } \ |
| 21 | } \ |
Nicola Mazzucato | 64f57d7 | 2024-06-24 12:13:22 +0100 | [diff] [blame] | 22 | } while (0) |
| 23 | #else |
| 24 | #define SPM_ASSERT(cond) |
| 25 | #endif |
| 26 | |
| 27 | #define assert(cond) SPM_ASSERT(cond) |
| 28 | |
| 29 | #endif /* __TFM_PRIV_ASSERT_H__ */ |