summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordavidcunado-arm <david.cunado@arm.com>2017-05-19 10:54:23 +0100
committerGitHub <noreply@github.com>2017-05-19 10:54:23 +0100
commit727a68b8ef02f48316ef13903a63af2638f6bbd3 (patch)
tree733f8c8a8d13e6a0eb9c2a3c781c4bc079fe402f /include
parent4fd4af26cb650d34876c058a7142c91233ba5475 (diff)
parent0da2fe7e29380f1b45286ae8a5a999547d250d33 (diff)
Merge pull request #936 from antonio-nino-diaz-arm/an/assert-mem
Simplify assert() to reduce memory usage
Diffstat (limited to 'include')
-rw-r--r--include/lib/stdlib/assert.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/lib/stdlib/assert.h b/include/lib/stdlib/assert.h
index 1bcd1ead..db567dbb 100644
--- a/include/lib/stdlib/assert.h
+++ b/include/lib/stdlib/assert.h
@@ -42,19 +42,36 @@
#ifndef _ASSERT_H_
#define _ASSERT_H_
+#include <debug.h>
+#include <platform_def.h>
#include <sys/cdefs.h>
+#ifndef PLAT_LOG_LEVEL_ASSERT
+#define PLAT_LOG_LEVEL_ASSERT LOG_LEVEL
+#endif
+
#if ENABLE_ASSERTIONS
#define _assert(e) assert(e)
-#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \
- __LINE__, #e))
+# if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_VERBOSE
+# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e))
+# elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
+# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__))
+# else
+# define assert(e) ((e) ? (void)0 : __assert())
+# endif
#else
#define assert(e) ((void)0)
#define _assert(e) ((void)0)
#endif /* ENABLE_ASSERTIONS */
__BEGIN_DECLS
-void __assert(const char *, const char *, int, const char *) __dead2;
+#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_VERBOSE
+void __assert(const char *, unsigned int, const char *) __dead2;
+#elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
+void __assert(const char *, unsigned int) __dead2;
+#else
+void __assert(void) __dead2;
+#endif
__END_DECLS
#endif /* !_ASSERT_H_ */