blob: acfd14732a398ad8639b12ffb7025d936c81ee2f [file] [log] [blame]
Imre Kisf55f2aa2024-05-28 15:55:19 +02001/*
2 * Copyright (c) 2018-2019, 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
12#include <common/debug.h>
13
14#ifndef PLAT_LOG_LEVEL_ASSERT
15#define PLAT_LOG_LEVEL_ASSERT LOG_LEVEL
16#endif
17
18#if ENABLE_ASSERTIONS
19# if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
20# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__))
21# else
22# define assert(e) ((e) ? (void)0 : __assert())
23# endif
24#else
25#define assert(e) ((void)0)
26#endif /* ENABLE_ASSERTIONS */
27
28#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
29void __dead2 __assert(const char *file, unsigned int line);
30#else
31void __dead2 __assert(void);
32#endif
33
34#endif /* ASSERT_H */