* [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM
@ 2022-11-08 12:10 Anup Patel
2022-11-09 15:07 ` Xiang W
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Anup Patel @ 2022-11-08 12:10 UTC (permalink / raw)
To: opensbi
We fix the following semihosting compile error observed using LLVM:
lib/utils/serial/semihosting.c:158:12: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
ret = ch > -1 ? ch : -1;
~~ ^ ~~
Fixes: 7f09fba86e43 ("lib: utils/serial: add semihosting support")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
lib/utils/serial/semihosting.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
index 5012fa1..86fa296 100644
--- a/lib/utils/serial/semihosting.c
+++ b/lib/utils/serial/semihosting.c
@@ -154,8 +154,8 @@ static int semihosting_getc(void)
int ret;
if (semihosting_infd < 0) {
- ch = semihosting_trap(SYSREADC, NULL);
- ret = ch > -1 ? ch : -1;
+ ret = semihosting_trap(SYSREADC, NULL);
+ ret = ret < 0 ? -1 : ret;
} else
ret = semihosting_read(semihosting_infd, &ch, 1) > 0 ? ch : -1;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM
2022-11-08 12:10 [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM Anup Patel
@ 2022-11-09 15:07 ` Xiang W
2022-11-14 16:09 ` Bin Meng
2022-11-15 11:16 ` Anup Patel
2 siblings, 0 replies; 4+ messages in thread
From: Xiang W @ 2022-11-09 15:07 UTC (permalink / raw)
To: opensbi
? 2022-11-08???? 17:40 +0530?Anup Patel???
> We fix the following semihosting compile error observed using LLVM:
> lib/utils/serial/semihosting.c:158:12: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-
> Wtautological-constant-out-of-range-compare]
> ??????????????? ret = ch > -1 ? ch : -1;
> ????????????????????? ~~ ^ ~~
>
> Fixes: 7f09fba86e43 ("lib: utils/serial: add semihosting support")
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
LGTM
Reviewed-by: Xiang W <wxjstz@126.com>
> ---
> ?lib/utils/serial/semihosting.c | 4 ++--
> ?1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
> index 5012fa1..86fa296 100644
> --- a/lib/utils/serial/semihosting.c
> +++ b/lib/utils/serial/semihosting.c
> @@ -154,8 +154,8 @@ static int semihosting_getc(void)
> ????????int ret;
> ?
> ????????if (semihosting_infd < 0)? {
> -???????????????ch = semihosting_trap(SYSREADC, NULL);
> -???????????????ret = ch > -1 ? ch : -1;
> +???????????????ret = semihosting_trap(SYSREADC, NULL);
> +???????????????ret = ret < 0 ? -1 : ret;
> ????????} else
> ????????????????ret = semihosting_read(semihosting_infd, &ch, 1) > 0 ? ch : -1;
> ?
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM
2022-11-08 12:10 [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM Anup Patel
2022-11-09 15:07 ` Xiang W
@ 2022-11-14 16:09 ` Bin Meng
2022-11-15 11:16 ` Anup Patel
2 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2022-11-14 16:09 UTC (permalink / raw)
To: opensbi
On Tue, Nov 8, 2022 at 8:12 PM Anup Patel <apatel@ventanamicro.com> wrote:
>
> We fix the following semihosting compile error observed using LLVM:
> lib/utils/serial/semihosting.c:158:12: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
> ret = ch > -1 ? ch : -1;
> ~~ ^ ~~
>
> Fixes: 7f09fba86e43 ("lib: utils/serial: add semihosting support")
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
> lib/utils/serial/semihosting.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM
2022-11-08 12:10 [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM Anup Patel
2022-11-09 15:07 ` Xiang W
2022-11-14 16:09 ` Bin Meng
@ 2022-11-15 11:16 ` Anup Patel
2 siblings, 0 replies; 4+ messages in thread
From: Anup Patel @ 2022-11-15 11:16 UTC (permalink / raw)
To: opensbi
On Tue, Nov 8, 2022 at 5:40 PM Anup Patel <apatel@ventanamicro.com> wrote:
>
> We fix the following semihosting compile error observed using LLVM:
> lib/utils/serial/semihosting.c:158:12: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
> ret = ch > -1 ? ch : -1;
> ~~ ^ ~~
>
> Fixes: 7f09fba86e43 ("lib: utils/serial: add semihosting support")
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Applied this patch to the riscv/opensbi repo.
Regards,
Anup
> ---
> lib/utils/serial/semihosting.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
> index 5012fa1..86fa296 100644
> --- a/lib/utils/serial/semihosting.c
> +++ b/lib/utils/serial/semihosting.c
> @@ -154,8 +154,8 @@ static int semihosting_getc(void)
> int ret;
>
> if (semihosting_infd < 0) {
> - ch = semihosting_trap(SYSREADC, NULL);
> - ret = ch > -1 ? ch : -1;
> + ret = semihosting_trap(SYSREADC, NULL);
> + ret = ret < 0 ? -1 : ret;
> } else
> ret = semihosting_read(semihosting_infd, &ch, 1) > 0 ? ch : -1;
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-15 11:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 12:10 [PATCH v2] lib: utils/serial: Fix semihosting compile error using LLVM Anup Patel
2022-11-09 15:07 ` Xiang W
2022-11-14 16:09 ` Bin Meng
2022-11-15 11:16 ` Anup Patel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox