Re: [PATCH 4/5] RISC-V: Add native linux support.

Andrew Burgess
2018-10-28T11:23:34Z

* Pedro Alves <palves@redhat.com> [2018-10-25 13:06:25 +0100]:

> On 10/25/2018 12:09 PM, Andrew Burgess wrote:
> >
> > I removed the extra { ... } block in line with the coding standard
> > while editing this area.
>
> Actually, this applies here:
>
> > Any two or more lines in code should be wrapped in braces, even if they are comments, as they look like separate statements:
> > if (i)
> > {
> > /* Return success. */
> > return 0;
> > }
> >
> > and not:
> >
> > if (i)
> > /* Return success. */
> > return 0;
>
> From:
>
> https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards?highlight=%28coding%29%7C%28conventions%29#Whitespaces
>

Sorry for this mistake.

I pushed the patch below to correct this.

Thanks,
Andrew

--

gdb/riscv: Add back missing braces in riscv-linux-nat.c

In this commit:

commit ee67fd7f3f6ca78eede2862e309c0bcf266bbd7e
Date: Thu Oct 25 12:03:31 2018 +0100

gdb/riscv: Use correct regnum in riscv_linux_nat_target::fetch_registers

I incorrectly removed a set of braces in violation of the GDB coding
standard. This commit adds them back.

gdb/ChangeLog:

* riscv-linux-nat.c (riscv_linux_nat_target::fetch_registers):
Add missing braces. No functional change.
---
gdb/ChangeLog | 5 +++++
gdb/riscv-linux-nat.c | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdb/riscv-linux-nat.c b/gdb/riscv-linux-nat.c
index c09121d052b..d51f6e30218 100644
--- a/gdb/riscv-linux-nat.c
+++ b/gdb/riscv-linux-nat.c
@@ -201,8 +201,10 @@ riscv_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)

if ((regnum == RISCV_CSR_MISA_REGNUM)
|| (regnum == -1))
- /* TODO: Need to add a ptrace call for this. */
- regcache->raw_supply_zeroed (RISCV_CSR_MISA_REGNUM);
+ {
+ /* TODO: Need to add a ptrace call for this. */
+ regcache->raw_supply_zeroed (RISCV_CSR_MISA_REGNUM);
+ }

/* Access to other CSRs has potential security issues, don't support them for
now. */
--
2.14.5