diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-05-07 00:26:36 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-05-07 00:34:25 -0400 |
commit | 0ae995e2df001ab7c45c4bc596c4b0b734910c08 (patch) | |
tree | d5dd7809954072111312b2eb027d8571f0263866 /sim/m32c | |
parent | a5884035977f95b09c28d4bb2276ac4869930e96 (diff) | |
download | gdb-0ae995e2df001ab7c45c4bc596c4b0b734910c08.zip gdb-0ae995e2df001ab7c45c4bc596c4b0b734910c08.tar.gz gdb-0ae995e2df001ab7c45c4bc596c4b0b734910c08.tar.bz2 |
sim: m32c: fix warnings about mixing code & decls
Add scope braces to a bunch of the generated sections to avoid compiler
warnings about mixing code & variable declarations.
Diffstat (limited to 'sim/m32c')
-rw-r--r-- | sim/m32c/ChangeLog | 5 | ||||
-rw-r--r-- | sim/m32c/m32c.opc | 13 | ||||
-rw-r--r-- | sim/m32c/r8c.opc | 14 |
3 files changed, 31 insertions, 1 deletions
diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog index ad2bece..aedcb6a 100644 --- a/sim/m32c/ChangeLog +++ b/sim/m32c/ChangeLog @@ -1,5 +1,10 @@ 2021-05-07 Mike Frysinger <vapier@gentoo.org> + * m32c.opc: Add scope braces around a few segments. + * r8c.opc: Likewise. + +2021-05-07 Mike Frysinger <vapier@gentoo.org> + * Makefile.in: Delete safe-fgets. * opc2c.c: Delete safe-fgets.h include. (main): Replace safe_fgets with getline. diff --git a/sim/m32c/m32c.opc b/sim/m32c/m32c.opc index efe0495..d19aaf0 100644 --- a/sim/m32c/m32c.opc +++ b/sim/m32c/m32c.opc @@ -1348,12 +1348,14 @@ next_opcode: /** 1101 sss1 ss01 1dst MOVA src,dest */ + { static reg_id map[8] = { r2r0, r3r1, a0, a1 }; prefix (0, 0, 0); sc = decode_src23 (sss, ss, 1); if (!sc.mem || !map[dst]) UNSUPPORTED(); put_reg (map[dst], sc.u.addr); + } /** 0000 0001 1011 ddd0 dd hl 1110 MOVdir R0L,dest */ @@ -1562,6 +1564,7 @@ next_opcode: /** 1000 1110 POPM dest */ + { static int map[] = { r0, r1, r2, r3, a0, a1, sb, fb }; prefix (0, 0, 0); imm = IMM(1); @@ -1580,18 +1583,22 @@ next_opcode: put_reg (map[a], v); put_reg (sp, get_reg (sp) + 4); } + } /** 1010 111w PUSH.size #IMM */ + { + int a; prefix (0, 0, 0); imm = IMM(w+1); tprintf("push%s: %x\n", w ? "hi" : "qi", imm); - int a = get_reg (sp) - 2; + a = get_reg (sp) - 2; if (w) mem_put_hi (a, imm); else mem_put_qi (a, imm); put_reg (sp, a); + } /** 1100 sss w ss00 1110 PUSH.size src */ @@ -1647,6 +1654,7 @@ next_opcode: /** 1000 1111 PUSHM src */ + { static int map[] = { fb, sb, a1, a0, r3, r2, r1, r0 }; imm = IMM(1); tprintf("pushm: %x\n", imm); @@ -1664,6 +1672,7 @@ next_opcode: v = get_reg (map[a]); mem_put_hi (get_reg (sp), v); } + } /** 1001 1110 REIT */ @@ -1676,6 +1685,7 @@ next_opcode: /** 1011 1000 010w 0011 RMPA.size */ + { int count = get_reg (r3); int list1 = get_reg (a0); int list2 = get_reg (a1); @@ -1705,6 +1715,7 @@ next_opcode: put_reg (a1, list2); put_reg (r2r0, (int)(sum & 0xffffffffU)); put_reg (r1, (int)(sum >> 32)); + } /** 1011 ddd w dd10 1110 ROLC.size dest */ diff --git a/sim/m32c/r8c.opc b/sim/m32c/r8c.opc index dc447b5..6645ff8 100644 --- a/sim/m32c/r8c.opc +++ b/sim/m32c/r8c.opc @@ -588,6 +588,7 @@ decode_r8c (void) /* w = width, i = immediate, c = carry, s = subtract */ + { int src = i ? IMM(w) : get_reg (w ? r1 : r0h); int dest = get_reg (w ? r0 : r0l); int res; @@ -622,6 +623,7 @@ decode_r8c (void) set_szc (res, w+1, c); put_reg (w ? r0 : r0l, res); + } /** 1010 1dst DEC.B dest */ @@ -980,9 +982,11 @@ decode_r8c (void) /** 1110 1011 0reg 1src MOVA src,dest */ + { static reg_id map[] = { r0, r1, r2, r3, a0, a1, 0, 0 }; sc = decode_srcdest4 (8 + src, 0); put_reg (map[reg], sc.u.addr); + } /** 0111 1100 10hl dest MOVdir R0L,dest */ @@ -1158,6 +1162,7 @@ decode_r8c (void) /** 1110 1101 POPM dest */ + { static int map[] = { r0, r1, r2, r3, a0, a1, sb, fb }; imm = IMM(0); tprintf("popm: %x\n", imm); @@ -1168,6 +1173,7 @@ decode_r8c (void) put_reg (map[a], v); put_reg (sp, get_reg (sp) + 2); } + } /** 0111 110w 1110 0010 PUSH.size:G #IMM */ @@ -1233,6 +1239,7 @@ decode_r8c (void) /** 1110 1100 PUSHM src */ + { static int map[] = { fb, sb, a1, a0, r3, r2, r1, r0 }; imm = IMM(0); tprintf("pushm: %x\n", imm); @@ -1243,6 +1250,7 @@ decode_r8c (void) v = get_reg (map[a]); mem_put_hi (get_reg (sp), v); } + } /** 1111 1011 REIT */ @@ -1257,6 +1265,7 @@ decode_r8c (void) /** 0111 110w 1111 0001 RMPA.size */ + { int count = get_reg (r3); int list1 = get_reg (a0); int list2 = get_reg (a1); @@ -1285,6 +1294,7 @@ decode_r8c (void) put_reg (a0, list1); put_reg (a1, list2); put_reg (w ? r2r0 : r0, sum); + } /** 0111 011w 1010 dest ROLC.size dest */ @@ -1370,6 +1380,7 @@ decode_r8c (void) /** 0111 110w 1110 100b SMOVB.size */ + { int count = get_reg (r3); int s1 = get_reg (a0) + (get_reg (r1h) << 16); int s2 = get_reg (a1); @@ -1395,9 +1406,11 @@ decode_r8c (void) put_reg (a0, s1 & 0xffff); put_reg (a1, s2); put_reg (r1h, s1 >> 16); + } /** 0111 110w 1110 1010 SSTR.size */ + { int count = get_reg (r3); int s1 = get_reg (a1); v = get_reg (w ? r0 : r0l); @@ -1418,6 +1431,7 @@ decode_r8c (void) } put_reg (r3, count); put_reg (a1, s1); + } /** 0111 1011 1src dest STC src,dest */ |