From 728a617bd4e3363f9277d81e0f598e3911208233 Mon Sep 17 00:00:00 2001 From: Liviu Ionescu Date: Tue, 3 Oct 2017 00:17:57 +0300 Subject: [PATCH 1/3] target/riscv: Silence -Werror=return-type - clang compains about the functions not returning a value --- src/target/riscv/asm.h | 2 ++ src/target/riscv/riscv-011.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/target/riscv/asm.h b/src/target/riscv/asm.h index 67ac14f84..8a2fd491c 100644 --- a/src/target/riscv/asm.h +++ b/src/target/riscv/asm.h @@ -17,6 +17,7 @@ static uint32_t load(const struct target *target, unsigned int rd, return ld(rd, base, offset); } assert(0); + return 0; // Silence -Werror=return-type } static uint32_t store(const struct target *target, unsigned int src, @@ -31,6 +32,7 @@ static uint32_t store(const struct target *target, unsigned int src, return sd(src, base, offset); } assert(0); + return 0; // Silence -Werror=return-type } #endif diff --git a/src/target/riscv/riscv-011.c b/src/target/riscv/riscv-011.c index 6b6666b4d..4f2e3a618 100644 --- a/src/target/riscv/riscv-011.c +++ b/src/target/riscv/riscv-011.c @@ -269,6 +269,7 @@ static unsigned int slot_offset(const struct target *target, slot_t slot) LOG_ERROR("slot_offset called with xlen=%d, slot=%d", riscv_xlen(target), slot); assert(0); + return 0; // Silence -Werror=return-type } static uint32_t load_slot(const struct target *target, unsigned int dest, From f5a69e547f91a0eef47cf02f27f744020b6b427c Mon Sep 17 00:00:00 2001 From: Liviu Ionescu Date: Tue, 3 Oct 2017 00:23:14 +0300 Subject: [PATCH 2/3] target/riscv/program.c: fix clang warning - I'm not sure I understand the logic behind the original statement, but on macOS it fails to compile. --- src/target/riscv/program.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/target/riscv/program.c b/src/target/riscv/program.c index 055bfdbaf..d052574d4 100644 --- a/src/target/riscv/program.c +++ b/src/target/riscv/program.c @@ -478,7 +478,11 @@ riscv_addr_t riscv_program_gah(struct riscv_program *p, riscv_addr_t addr) riscv_addr_t riscv_program_gal(struct riscv_program *p, riscv_addr_t addr) { - return ((addr > 0) ? 1 : 0) * (addr & 0x7FF); + if (addr > 0) { + return (addr & 0x7FF); + } else { + return 0; + } } int riscv_program_lah(struct riscv_program *p, enum gdb_regno d, riscv_addr_t addr) From f9f303923e2ce16f9695efc8a4abf770d0122476 Mon Sep 17 00:00:00 2001 From: Liviu Ionescu Date: Tue, 3 Oct 2017 00:36:22 +0300 Subject: [PATCH 3/3] target/riscv/asm.h: use tab for indentation --- src/target/riscv/asm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/target/riscv/asm.h b/src/target/riscv/asm.h index 8a2fd491c..f976e2065 100644 --- a/src/target/riscv/asm.h +++ b/src/target/riscv/asm.h @@ -17,7 +17,7 @@ static uint32_t load(const struct target *target, unsigned int rd, return ld(rd, base, offset); } assert(0); - return 0; // Silence -Werror=return-type + return 0; // Silence -Werror=return-type } static uint32_t store(const struct target *target, unsigned int src, @@ -32,7 +32,7 @@ static uint32_t store(const struct target *target, unsigned int src, return sd(src, base, offset); } assert(0); - return 0; // Silence -Werror=return-type + return 0; // Silence -Werror=return-type } #endif