]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Minor cleanup to ada_identical_enum_types_p
authorTom Tromey <tromey@adacore.com>
Mon, 26 Aug 2024 17:29:01 +0000 (11:29 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 9 Sep 2024 17:47:17 +0000 (11:47 -0600)
This moves the declaration of 'i' into the 'for' loops in
ada_identical_enum_types_p.  This is just a trivial cleanup.

Approved-By: Tom de Vries <tdevries@suse.de>
gdb/ada-lang.c

index 8d5d6671c8d117b27833055ce9fe2d3e24cb2080..57f2b2bb9a792b379c16066ffe092ededf8f66ee 100644 (file)
@@ -4976,21 +4976,19 @@ is_nondebugging_type (struct type *type)
 static bool
 ada_identical_enum_types_p (struct type *type1, struct type *type2)
 {
-  int i;
-
   /* The heuristic we use here is fairly conservative.  We consider
      that 2 enumerate types are identical if they have the same
      number of enumerals and that all enumerals have the same
      underlying value and name.  */
 
   /* All enums in the type should have an identical underlying value.  */
-  for (i = 0; i < type1->num_fields (); i++)
+  for (int i = 0; i < type1->num_fields (); i++)
     if (type1->field (i).loc_enumval () != type2->field (i).loc_enumval ())
       return false;
 
   /* All enumerals should also have the same name (modulo any numerical
      suffix).  */
-  for (i = 0; i < type1->num_fields (); i++)
+  for (int i = 0; i < type1->num_fields (); i++)
     {
       const char *name_1 = type1->field (i).name ();
       const char *name_2 = type2->field (i).name ();