Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef ASSERT_H |
| 8 | #define ASSERT_H |
| 9 | |
| 10 | #include <cdefs.h> |
| 11 | |
Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 12 | #include <common/debug.h> |
| 13 | |
Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 14 | #if ENABLE_ASSERTIONS |
Ambroise Vincent | 8a573de | 2019-02-11 13:54:30 +0000 | [diff] [blame] | 15 | #define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e)) |
Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 16 | #else |
| 17 | #define assert(e) ((void)0) |
| 18 | #endif /* ENABLE_ASSERTIONS */ |
| 19 | |
Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 20 | __dead2 void __assert(const char *file, unsigned int line, |
| 21 | const char *assertion); |
Ambroise Vincent | 4128f9f | 2019-02-11 13:34:41 +0000 | [diff] [blame] | 22 | |
| 23 | #endif /* ASSERT_H */ |