mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-09 02:51:21 +00:00
refactor(libc): clean up dependencies in libc
- Removing platform dependencies from libc modules. - Replacing panicking with actual error handling. - Debug macros are included indirectly from assert.h. Removing "platform_def.h" from assert.h and adding "common/debug.h" where the macros are used. - Removing hack for fixing PLAT_LOG_LEVEL_ASSERT to 40. Instead removing assert with expression, as this does not provide additional information. Signed-off-by: Claus Pedersen <claustbp@google.com> Change-Id: Icc201ea7b63c1277e423c1cfd13fd6816c2bc568
This commit is contained in:
parent
93910a7487
commit
885e268304
33 changed files with 51 additions and 41 deletions
|
@ -6,11 +6,10 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <plat/common/platform.h>
|
||||
|
||||
#define get_num_va_args(_args, _lcount) \
|
||||
(((_lcount) > 1) ? va_arg(_args, long long int) : \
|
||||
(((_lcount) == 1) ? va_arg(_args, long int) : \
|
||||
|
@ -51,10 +50,10 @@ static void unsigned_num_print(char **s, size_t n, size_t *chars_printed,
|
|||
unsigned int rem;
|
||||
char ascii_a = capitalise ? 'A' : 'a';
|
||||
|
||||
/* num_buf is only large enough for radix >= 10 */
|
||||
if (radix < 10) {
|
||||
ERROR("snprintf: unsupported radix '%u'.", radix);
|
||||
plat_panic_handler();
|
||||
assert(0); /* Unreachable */
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -218,11 +217,8 @@ loop:
|
|||
break;
|
||||
|
||||
default:
|
||||
/* Panic on any other format specifier. */
|
||||
ERROR("snprintf: specifier with ASCII code '%d' not supported.",
|
||||
*fmt);
|
||||
plat_panic_handler();
|
||||
assert(0); /* Unreachable */
|
||||
CHECK_AND_PUT_CHAR(s, n, chars_printed, '%');
|
||||
CHECK_AND_PUT_CHAR(s, n, chars_printed, *fmt);
|
||||
}
|
||||
fmt++;
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue