Fix ARI violation in ada_tasks_inferior_data_sniffer.
authorJoel Brobecker <brobecker@gnat.com>
Tue, 28 Feb 2012 16:30:42 +0000 (16:30 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 28 Feb 2012 16:30:42 +0000 (16:30 +0000)
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.

gdb/ChangeLog
gdb/ada-tasks.c

index 6fcb90f23bfcc2cb64c3f5fed2d782da63489b50..a4857b87b3fb17f5506864a15118af0e35dba290 100644 (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>
 
        Fix static analysis issue found by cppcheck.
index 4c0b66795c9b25717cd196b809c10dfae1dfc2c5..11ad2621e581ff9afaaeb1b9301a6e43a368c1da 100644 (file)
@@ -870,13 +870,15 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
        {
          /* Validate.  */
          struct type *type = check_typedef (SYMBOL_TYPE (sym));
-         struct type *eltype;
-         struct type *idxtype;
-
-         if (TYPE_CODE (type) == TYPE_CODE_ARRAY
-             && (eltype = check_typedef (TYPE_TARGET_TYPE (type)))
-             && TYPE_CODE (eltype) == TYPE_CODE_PTR
-             && (idxtype = check_typedef (TYPE_INDEX_TYPE (type)))
+         struct type *eltype = NULL;
+         struct type *idxtype = NULL;
+
+         if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+           eltype = check_typedef (TYPE_TARGET_TYPE (type));
+         if (eltype != NULL
+             && TYPE_CODE (eltype) == TYPE_CODE_PTR)
+           idxtype = check_typedef (TYPE_INDEX_TYPE (type));
+         if (idxtype != NULL
              && !TYPE_LOW_BOUND_UNDEFINED (idxtype)
              && !TYPE_HIGH_BOUND_UNDEFINED (idxtype))
            {