diff options
author | Nick Clifton <nickc@redhat.com> | 2015-04-29 16:02:02 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-04-29 16:02:02 +0100 |
commit | 0a13382c8e708fd9eb15dbc81cedc35e6670090c (patch) | |
tree | 9fd21d2d6d7d18ce08e5c4d1f74cf91f57fb631a /sim | |
parent | 998d2a3ef31378d3d980972dc68f4926b720a7e9 (diff) | |
download | gdb-0a13382c8e708fd9eb15dbc81cedc35e6670090c.zip gdb-0a13382c8e708fd9eb15dbc81cedc35e6670090c.tar.gz gdb-0a13382c8e708fd9eb15dbc81cedc35e6670090c.tar.bz2 |
Fix problems in the sim sources discovered by running the cppcheck static analysis tool.
erc32 PR 18273
* sis.c (main): Remove unreachable code.
m68hc11 * gencode.c (gen_fetch_operands): Remove unreachable code.
ppc * hw_htab.c (htab_map_binary): Fix overlap check.
common * sim-fpu.c (INLINE_SIM_FPU): Fix static analysis warning by
increasing parenthesis around casts to signed values.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/common/ChangeLog | 7 | ||||
-rw-r--r-- | sim/common/sim-fpu.c | 4 | ||||
-rw-r--r-- | sim/erc32/ChangeLog | 5 | ||||
-rw-r--r-- | sim/erc32/sis.c | 4 | ||||
-rw-r--r-- | sim/m68hc11/ChangeLog | 5 | ||||
-rw-r--r-- | sim/m68hc11/gencode.c | 3 | ||||
-rw-r--r-- | sim/ppc/ChangeLog | 5 | ||||
-rw-r--r-- | sim/ppc/hw_htab.c | 2 |
8 files changed, 29 insertions, 6 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 3c4428f..ebf8618 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +2015-04-29 Nick Clifton <nickc@redhat.com> + + PR 18273 + * sim-fpu.c (INLINE_SIM_FPU): Fix static analysis warning by + increasing parenthesis around casts to signed values. + + 2015-04-21 Mike Frysinger <vapier@gentoo.org> * gennltvals.sh: Add mcore support. diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c index f3e7f96..b6d35d1 100644 --- a/sim/common/sim-fpu.c +++ b/sim/common/sim-fpu.c @@ -1107,7 +1107,7 @@ sim_fpu_add (sim_fpu *f, /* sign? */ f->class = sim_fpu_class_number; - if ((signed64) f->fraction >= 0) + if (((signed64) f->fraction) >= 0) f->sign = 0; else { @@ -1261,7 +1261,7 @@ sim_fpu_sub (sim_fpu *f, /* sign? */ f->class = sim_fpu_class_number; - if ((signed64) f->fraction >= 0) + if (((signed64) f->fraction) >= 0) f->sign = 0; else { diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog index 4f9b502..688dc64 100644 --- a/sim/erc32/ChangeLog +++ b/sim/erc32/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Nick Clifton <nickc@redhat.com> + + PR 18273 + * sis.c (main): Remove unreachable code. + 2015-04-24 David Binderman <dcb314@hotmail.com> Nick Clifton <nickc@redhat.com> diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c index 92880e1..180d97e 100644 --- a/sim/erc32/sis.c +++ b/sim/erc32/sis.c @@ -169,7 +169,7 @@ main(argc, argv) while (stat < argc) { if (argv[stat][0] == '-') { if (strcmp(argv[stat], "-v") == 0) { - sis_verbose = 1; + sis_verbose += 1; } else if (strcmp(argv[stat], "-c") == 0) { if ((stat + 1) < argc) { copt = 1; @@ -202,8 +202,6 @@ main(argc, argv) #endif } else if (strcmp(argv[stat], "-dumbio") == 0) { dumbio = 1; - } else if (strcmp(argv[stat], "-v") == 0) { - sis_verbose += 1; } else { printf("unknown option %s\n", argv[stat]); usage(); diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog index 957abb5..f87aedf 100644 --- a/sim/m68hc11/ChangeLog +++ b/sim/m68hc11/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Nick Clifton <nickc@redhat.com> + + PR 18273 + * gencode.c (gen_fetch_operands): Remove unreachable code. + 2015-04-18 Mike Frysinger <vapier@gentoo.org> * sim-main.h (SIM_CPU): Delete. diff --git a/sim/m68hc11/gencode.c b/sim/m68hc11/gencode.c index dd9aa5f..ffc285c 100644 --- a/sim/m68hc11/gencode.c +++ b/sim/m68hc11/gencode.c @@ -1466,6 +1466,8 @@ gen_fetch_operands (FILE *fp, int col, vars[cur_var], operand_size, operand_size); operands += 1; } +#if 0 /* This code is never executed (see strncmp above), but it has not been + removed because it may be that there is a typo in strncmp test below. */ else if (strncmp (operands, "]", 1) == 0) { current_insn_size += 1; @@ -1473,6 +1475,7 @@ gen_fetch_operands (FILE *fp, int col, vars[cur_var], operand_size, operand_size); operands += 1; } +#endif else { fatal_error (opcode, "Unknown operand"); diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index cd185ba..1297df1 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,8 @@ +2015-04-29 Nick Clifton <nickc@redhat.com> + + PR 18273 + * hw_htab.c (htab_map_binary): Fix overlap check. + 2015-04-13 Mike Frysinger <vapier@gentoo.org> * Makefile.in (version.o): Change to using create-version.sh from gdb. diff --git a/sim/ppc/hw_htab.c b/sim/ppc/hw_htab.c index c49b323..cf275ff 100644 --- a/sim/ppc/hw_htab.c +++ b/sim/ppc/hw_htab.c @@ -549,7 +549,7 @@ htab_map_binary(device *me, if ((sizes.text_base <= sizes.data_base && sizes.text_bound >= sizes.data_bound) || (sizes.data_base <= sizes.text_base - && sizes.data_bound >= sizes.data_bound) + && sizes.data_bound >= sizes.text_bound) || (sizes.text_bound > sizes.data_base && sizes.text_bound <= sizes.data_bound) || (sizes.text_base >= sizes.data_base |