This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: Remove unused return values


This patch removes the return values of the c++ vtable functions. There
are three reasons for doing this. First of all, no function uses the
returned value. Second, it removes the ugly cast in the pseudo ops table.
Third and most important: I'm trying to find the right way to write vtable
info to special sections, and when this happens, the returned info will no
longer exist.

If you are interested in the general vtable implementation, please contact
me. I need as much feedback as possible because I'm very unfamiliar with
the code I'm changing.

I don't have write access, so if it's approved, please apply it for me.

Bo.

2001-03-08  Bo Thorsen  <bo@suse.de>

	* config/obj-elf.c (obj_elf_vtable_inherit): Remove return type.
	(obj_elf_vtable_entry): Likewise.
	* config/obj-elf.h: Remove the two return types.

Index: config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.28
diff -u -r1.28 obj-elf.c
--- obj-elf.c	2000/11/16 19:29:12	1.28
+++ obj-elf.c	2001/03/08 10:39:20
@@ -111,8 +111,8 @@
   {"subsection", obj_elf_subsection, 0},

   /* These are GNU extensions to aid in garbage collecting C++ vtables.  */
-  {"vtable_inherit", (void (*) PARAMS ((int))) &obj_elf_vtable_inherit, 0},
-  {"vtable_entry", (void (*) PARAMS ((int))) &obj_elf_vtable_entry, 0},
+  {"vtable_inherit", obj_elf_vtable_inherit, 0},
+  {"vtable_entry", obj_elf_vtable_entry, 0},

   /* These are used for dwarf.  */
   {"2byte", cons, 2},
@@ -614,6 +614,9 @@
   { ".shstrtab",SHT_STRTAB,	0				},
   { ".strtab",	SHT_STRTAB,	/* SHF_ALLOC */			},
   { ".symtab",	SHT_SYMTAB,	/* SHF_ALLOC */			},
+
+  /* Special section to handle c++ vtable special relocations.  */
+  { ".vtable",	SHT_PROGBITS,	0				},
 #endif

   { NULL,	0,		0				}
@@ -1162,7 +1165,7 @@
    to the linker the hierarchy in which a particular table resides.  The
    syntax is ".vtable_inherit CHILDNAME, PARENTNAME".  */

-struct fix *
+void
 obj_elf_vtable_inherit (ignore)
      int ignore ATTRIBUTE_UNUSED;
 {
@@ -1195,7 +1198,7 @@
     {
       as_bad ("expected comma after name in .vtable_inherit");
       ignore_rest_of_line ();
-      return NULL;
+      return;
     }

   ++input_line_pointer;
@@ -1222,19 +1225,21 @@
   demand_empty_rest_of_line ();

   if (bad)
-    return NULL;
+    return;

   assert (symbol_get_value_expression (csym)->X_op == O_constant);
-  return fix_new (symbol_get_frag (csym),
-		  symbol_get_value_expression (csym)->X_add_number,
-		  0, psym, 0, 0, BFD_RELOC_VTABLE_INHERIT);
+
+  /* Write the vtable inheritance.  */
+  fix_new (symbol_get_frag (csym),
+	   symbol_get_value_expression (csym)->X_add_number,
+	   0, psym, 0, 0, BFD_RELOC_VTABLE_INHERIT);
 }

 /* This handles the .vtable_entry pseudo-op, which is used to indicate
    to the linker that a vtable slot was used.  The syntax is
    ".vtable_entry tablename, offset".  */

-struct fix *
+void
 obj_elf_vtable_entry (ignore)
      int ignore ATTRIBUTE_UNUSED;
 {
@@ -1256,7 +1261,7 @@
     {
       as_bad ("expected comma after name in .vtable_entry");
       ignore_rest_of_line ();
-      return NULL;
+      return;
     }

   ++input_line_pointer;
@@ -1267,8 +1272,8 @@

   demand_empty_rest_of_line ();

-  return fix_new (frag_now, frag_now_fix (), 0, sym, offset, 0,
-		  BFD_RELOC_VTABLE_ENTRY);
+  fix_new (frag_now, frag_now_fix (), 0, sym, offset, 0,
+	   BFD_RELOC_VTABLE_ENTRY);
 }

 void
Index: config/obj-elf.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.h,v
retrieving revision 1.13
diff -u -r1.13 obj-elf.h
--- obj-elf.h	2001/01/11 21:20:17	1.13
+++ obj-elf.h	2001/03/08 10:39:21
@@ -163,8 +163,8 @@
 extern void obj_elf_common PARAMS ((int));
 extern void obj_elf_data PARAMS ((int));
 extern void obj_elf_text PARAMS ((int));
-extern struct fix *obj_elf_vtable_inherit PARAMS ((int));
-extern struct fix *obj_elf_vtable_entry PARAMS ((int));
+extern void obj_elf_vtable_inherit PARAMS ((int));
+extern void obj_elf_vtable_entry PARAMS ((int));

 /* BFD wants to write the udata field, which is a no-no for the
    globally defined sections.  */


-- 

     Bo Thorsen                 |   Lahnsgade 31, st.
     Free software developer    |   5000 Odense C
     SuSE Labs                  |   Denmark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]