From a211fde940d4dbd8e95e4f352af2a066a4f89f30 Mon Sep 17 00:00:00 2001 From: Yann Gautier Date: Mon, 14 Feb 2022 10:29:32 +0100 Subject: [PATCH] fix(libc): correct some messages Replace %d with %u in logs, to avoid warning when -Wformat-signedness is enabled. Signed-off-by: Yann Gautier Change-Id: Id058f6fb0fd25ce5f83b1be41082403fcb205841 --- lib/libc/assert.c | 6 +++--- lib/libc/snprintf.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libc/assert.c b/lib/libc/assert.c index ff987b3be..c199de6f7 100644 --- a/lib/libc/assert.c +++ b/lib/libc/assert.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -21,7 +21,7 @@ void __dead2 __assert(const char *file, unsigned int line, const char *assertion) { - printf("ASSERT: %s:%d:%s\n", file, line, assertion); + printf("ASSERT: %s:%u:%s\n", file, line, assertion); backtrace("assert"); console_flush(); plat_panic_handler(); @@ -29,7 +29,7 @@ void __dead2 __assert(const char *file, unsigned int line, #elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO void __dead2 __assert(const char *file, unsigned int line) { - printf("ASSERT: %s:%d\n", file, line); + printf("ASSERT: %s:%u\n", file, line); backtrace("assert"); console_flush(); plat_panic_handler(); diff --git a/lib/libc/snprintf.c b/lib/libc/snprintf.c index f34cefd6a..675d2430d 100644 --- a/lib/libc/snprintf.c +++ b/lib/libc/snprintf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -42,7 +42,7 @@ static void unsigned_num_print(char **s, size_t n, size_t *chars_printed, char ascii_a = capitalise ? 'A' : 'a'; if (radix < 10) { - ERROR("snprintf: unsupported radix '%d'.", radix); + ERROR("snprintf: unsupported radix '%u'.", radix); plat_panic_handler(); assert(0); /* Unreachable */ }