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]

Re: Warning fixes for ld/*


Alan Modra <amodra@bigpond.net.au> writes:

> On Sun, Sep 02, 2001 at 01:23:10PM +0200, Andreas Jaeger wrote:
> > 
>> There's one case I wasn't sure and left it:
>> beos.em contains these lines:
>> #if 0 /* argument to qsort so don't prototype */
>> static int sort_by_file_name PARAMS ((void *, void *));
>> static int sort_by_section_name PARAMS ((void *, void *));
>> #endif
>> static lang_statement_union_type **sort_sections_1
>>   PARAMS ((lang_statement_union_type **, lang_statement_union_type *, int,
>> 	   int (*)()));
>> 
>> And therefore I still get some warnings in ei386beos.  I don't know
>> why we don't want prototypes here.
>
> I think we probably do, but using "const void *", or better, "const PTR",
> since we are trying to be K&R compatible.  Change the function definition
> too, of course!

Here's the patch that I've committed,
Andreas

2001-09-03  Andreas Jaeger  <aj@suse.de>

	* emultempl/beos.em: Declare prototypes for comparions functions,
	adjust definitions.

============================================================
Index: ld/emultempl/beos.em
--- ld/emultempl/beos.em	2001/09/03 06:43:36	1.14
+++ ld/emultempl/beos.em	2001/09/03 07:12:49
@@ -60,13 +60,11 @@ static boolean gld${EMULATION_NAME}_plac
 static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *));
 static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
 
-#if 0 /* argument to qsort so don't prototype */
-static int sort_by_file_name PARAMS ((void *, void *));
-static int sort_by_section_name PARAMS ((void *, void *));
-#endif
+static int sort_by_file_name PARAMS ((const PTR, const PTR));
+static int sort_by_section_name PARAMS ((const PTR, const PTR));
 static lang_statement_union_type **sort_sections_1
   PARAMS ((lang_statement_union_type **, lang_statement_union_type *, int,
-	   int (*)()));
+	   int (*) PARAMS((const PTR, const PTR))));
 static void sort_sections PARAMS ((lang_statement_union_type *));
 
 static void set_pe_name PARAMS ((char *, long int));
@@ -460,8 +458,8 @@ gld_${EMULATION_NAME}_after_open()
 
 static int
 sort_by_file_name (a, b)
-     void *a;
-     void *b;
+     const PTR a;
+     const PTR b;
 {
   lang_statement_union_type **ra = a;
   lang_statement_union_type **rb = b;
@@ -517,8 +515,8 @@ return 0;
 
 static int
 sort_by_section_name (a, b)
-     void *a;
-     void *b;
+     const PTR a;
+     const PTR b;
 {
   lang_statement_union_type **ra = a;
   lang_statement_union_type **rb = b;
@@ -546,7 +544,7 @@ static lang_statement_union_type **
 sort_sections_1 (startptr, next_after, count, sort_func)
      lang_statement_union_type **startptr,*next_after;
      int count;
-     int (*sort_func) ();
+     int (*sort_func) PARAMS ((const PTR, const PTR));
 {
   lang_statement_union_type **vec;
   lang_statement_union_type *p;

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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