]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ppc-aix osabi sniffer: Turn test of bfd flavour into assertion
authorJoel Brobecker <brobecker@gnat.com>
Fri, 19 Oct 2012 19:58:18 +0000 (19:58 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Fri, 19 Oct 2012 19:58:18 +0000 (19:58 +0000)
Due to the way this function is registers, we know that given bfd's
flavour should always be bfd_target_xcoff_flavour, thus making
the former test always true, which means that this function should
always return GDB_OSABI_AIX, and never return GDB_OSABI_UNKNOWN.

This patch also fixes a typo detected by Tom Tromey that caused
the test itself to be completely ineffective.

gdb/ChangeLog (by Tom Tromey and Joel Brobecker):

        * rs6000-aix-tdep.c (rs6000_aix_osabi_sniffer): Replace
        inneffective if condition by gdb assertion.  Add function
        description comment.

gdb/ChangeLog
gdb/rs6000-aix-tdep.c

index 96c9cfaf8d1531fa868e25aaa2ec61ac3558d25a..52583885eee980ee73ed4aac7606bb8c59280254 100644 (file)
@@ -1,3 +1,10 @@
+2012-10-10  Joel Brobecker  <brobecker@adacore.com>
+            Tom Tromey  <tromey@redhat.com>
+
+       * rs6000-aix-tdep.c (rs6000_aix_osabi_sniffer): Replace
+       inneffective if condition by gdb assertion.  Add function
+       description comment.
+
 2012-10-19  Joel Brobecker  <brobecker@adacore.com>
 
        * parser-defs.h (struct exp_descriptor): Document constraint
index 59cfa73b495685795f817473b2e98ef01936eddb..06b43de217a24ca97ffdafeeb525556975457048 100644 (file)
@@ -719,14 +719,19 @@ rs6000_software_single_step (struct frame_info *frame)
   return 1;
 }
 
+/* Implement an osabi sniffer for RS6000/AIX.
+
+   This function assumes that ABFD's flavour is XCOFF.  In other words,
+   it should be registered as a sniffer for bfd_target_xcoff_flavour
+   objfiles only.  A failed assertion will be raised if this condition
+   is not met.  */
+
 static enum gdb_osabi
 rs6000_aix_osabi_sniffer (bfd *abfd)
 {
-  
-  if (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
-    return GDB_OSABI_AIX;
+  gdb_assert (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
 
-  return GDB_OSABI_UNKNOWN;
+  return GDB_OSABI_AIX;
 }
 
 static void