diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-01 11:16:29 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2021-02-08 11:01:07 +0000 |
commit | 783a7b12d3463ebbc25c6c2c1006b6363ec538e3 (patch) | |
tree | 5dcb999463ae58917f3c801762f1328f59352683 /sim | |
parent | b9fe995797542ac6a2bd05c1864eeb53dbfdebf7 (diff) | |
download | gdb-783a7b12d3463ebbc25c6c2c1006b6363ec538e3.zip gdb-783a7b12d3463ebbc25c6c2c1006b6363ec538e3.tar.gz gdb-783a7b12d3463ebbc25c6c2c1006b6363ec538e3.tar.bz2 |
sim/rx: move some variable declarations to the start of the block
For sim code variables still need to be declared at the start of the
enclosing block. This silences a few GCC warnings.
sim/rx/ChangeLog:
* syscalls.c (rx_syscall): Move declaration of some variables to
the start of the enclosing block.
* trace.c (load_file_and_line): Likewise.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/rx/ChangeLog | 6 | ||||
-rw-r--r-- | sim/rx/syscalls.c | 5 | ||||
-rw-r--r-- | sim/rx/trace.c | 3 |
3 files changed, 11 insertions, 3 deletions
diff --git a/sim/rx/ChangeLog b/sim/rx/ChangeLog index 320d164..6b4b3d9 100644 --- a/sim/rx/ChangeLog +++ b/sim/rx/ChangeLog @@ -1,5 +1,11 @@ 2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com> + * syscalls.c (rx_syscall): Move declaration of some variables to + the start of the enclosing block. + * trace.c (load_file_and_line): Likewise. + +2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com> + * reg.c (fpsw2str): Provide a format string to printf. (trace_register_changes): Likewise. diff --git a/sim/rx/syscalls.c b/sim/rx/syscalls.c index 2f89da1..22778b3 100644 --- a/sim/rx/syscalls.c +++ b/sim/rx/syscalls.c @@ -160,6 +160,7 @@ rx_syscall (int id) case SYS_open: { + int oflags, cflags; int path = arg (); /* The open function is defined as taking a variable number of arguments because the third parameter to it is optional: @@ -167,8 +168,8 @@ rx_syscall (int id) Hence the oflags and cflags arguments will be on the stack and we need to skip the (empty) argument registers r3 and r4. */ argp = 4; - int oflags = arg (); - int cflags = arg (); + oflags = arg (); + cflags = arg (); read_target (buf, path, 256, 1); if (trace) diff --git a/sim/rx/trace.c b/sim/rx/trace.c index 6f9294a..9d9f2df 100644 --- a/sim/rx/trace.c +++ b/sim/rx/trace.c @@ -139,6 +139,7 @@ load_file_and_line (const char *filename, int lineno) break; if (!f) { + FILE *file; int i; struct stat s; const char *found_filename, *slash; @@ -159,7 +160,7 @@ load_file_and_line (const char *filename, int lineno) files = f; f->filename = strdup (filename); f->data = (char *) malloc (s.st_size + 2); - FILE *file = fopen (found_filename, "rb"); + file = fopen (found_filename, "rb"); fread (f->data, 1, s.st_size, file); f->data[s.st_size] = 0; fclose (file); |