diff mbox series

[v3,6/6] Remove assert()

Message ID 1515548724-31869-7-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series assert() is almost used in the same way as BUG_ON(), except: | expand

Commit Message

Masahiro Yamada Jan. 10, 2018, 1:45 a.m. UTC
No more users of assert() except host tools.  Remove.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
 - Rebase on v2017.01

Changes in v2: None

 include/log.h     | 15 ---------------
 lib/tiny-printf.c |  9 ---------
 lib/vsprintf.c    |  9 ---------
 3 files changed, 33 deletions(-)
diff mbox series

Patch

diff --git a/include/log.h b/include/log.h
index 8083b64..60a77c4 100644
--- a/include/log.h
+++ b/include/log.h
@@ -141,21 +141,6 @@  int _log(enum log_category_t cat, enum log_level_t level, const char *file,
 #define warn_non_spl(fmt, args...)			\
 	debug_cond(!_SPL_BUILD, fmt, ##args)
 
-/*
- * An assertion is run-time check done in debug mode only. If DEBUG is not
- * defined then it is skipped. If DEBUG is defined and the assertion fails,
- * then it calls panic*( which may or may not reset/halt U-Boot (see
- * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found
- * before release, and after release it is hoped that they don't matter. But
- * in any case these failing assertions cannot be fixed with a reset (which
- * may just do the same assertion again).
- */
-void __assert_fail(const char *assertion, const char *file, unsigned int line,
-		   const char *function);
-#define assert(x) \
-	({ if (!(x) && _DEBUG) \
-		__assert_fail(#x, __FILE__, __LINE__, __func__); })
-
 /**
  * struct log_rec - a single log record
  *
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 0b04813..d5b6d69 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -381,12 +381,3 @@  int snprintf(char *buf, size_t size, const char *fmt, ...)
 
 	return ret;
 }
-
-void __assert_fail(const char *assertion, const char *file, unsigned line,
-		   const char *function)
-{
-	/* This will not return */
-	printf("%s:%u: %s: Assertion `%s' failed.", file, line, function,
-	       assertion);
-	hang();
-}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index dd572d2..4208239 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -789,15 +789,6 @@  int vprintf(const char *fmt, va_list args)
 	return i;
 }
 
-
-void __assert_fail(const char *assertion, const char *file, unsigned line,
-		   const char *function)
-{
-	/* This will not return */
-	panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
-	      assertion);
-}
-
 char *simple_itoa(ulong i)
 {
 	/* 21 digits plus null terminator, good for 64-bit or smaller ints */