Fix ARI violation in ada_tasks_inferior_data_sniffer.

This patch removes some variable assignments inside condition
expressions.

gdb/ChangeLog:

        * ada-tasks.c (ada_tasks_inferior_data_sniffer): Rework code to
        avoid variable assignments inside condition.
This commit is contained in:
Joel Brobecker 2012-02-28 16:30:42 +00:00
parent 7964b62a37
commit d4cd3da9f3
2 changed files with 14 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2012-02-28 Joel Brobecker <brobecker@adacore.com>
From Tristan Gingold <gingold@adacore.com>.
* ada-tasks.c (ada_tasks_inferior_data_sniffer): Rework code to
avoid variable assignments inside condition.
2012-02-28 Jan Kratochvil <jan.kratochvil@redhat.com> 2012-02-28 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix static analysis issue found by cppcheck. Fix static analysis issue found by cppcheck.

View File

@ -870,13 +870,15 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
{ {
/* Validate. */ /* Validate. */
struct type *type = check_typedef (SYMBOL_TYPE (sym)); struct type *type = check_typedef (SYMBOL_TYPE (sym));
struct type *eltype; struct type *eltype = NULL;
struct type *idxtype; struct type *idxtype = NULL;
if (TYPE_CODE (type) == TYPE_CODE_ARRAY if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
&& (eltype = check_typedef (TYPE_TARGET_TYPE (type))) eltype = check_typedef (TYPE_TARGET_TYPE (type));
&& TYPE_CODE (eltype) == TYPE_CODE_PTR if (eltype != NULL
&& (idxtype = check_typedef (TYPE_INDEX_TYPE (type))) && TYPE_CODE (eltype) == TYPE_CODE_PTR)
idxtype = check_typedef (TYPE_INDEX_TYPE (type));
if (idxtype != NULL
&& !TYPE_LOW_BOUND_UNDEFINED (idxtype) && !TYPE_LOW_BOUND_UNDEFINED (idxtype)
&& !TYPE_HIGH_BOUND_UNDEFINED (idxtype)) && !TYPE_HIGH_BOUND_UNDEFINED (idxtype))
{ {