This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


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

gdb 4.16.98 patch : fix compilation errors & warnings



Here are some patches to fix compilation errors and warnings when compiling
gdb-4.16.98 with the native cc of m68k-motorola-sysv, used as a portability
tester.
At the end of this message you'll find the errors and warnings that I got.

For gdb :
Wed Apr 22 00:32:32 1998  Philippe De Muyter  <phdm@macqel.be>

	* symfile.c (simple_overlay_update_1): Do not prefix array address
	by `&'.
	* bcache.h (BCACHE_DATA_ALIGNMENT): Ditto.
	* tracepoint.c (encode_actions): Ditto.
	* language.c, complaints.c, utils.c (varargs.h): Do not include that
	file here, it is already included indirectly by defs.h.
	* dbxread.c (dbx_symfile_init, process_one_symbol): Cast xmalloc return
	value to the appropriate pointer type.
	* utils.c (floatformat_from_doublest): Ditto.
	* tracepoint.c (read_actions, _initialize_tracepoint): Ditto.
	(add_memrange): Likewise with xrealloc return value.
	* stabsread.c (ref_add): Ditto.
	* coffread.c (coff_symfile_init): Likewise for xmmalloc return value.
	* elfread.c (elf_symfile_read): Ditto.
	* os9kread.c (os9k_symfile_init): Ditto.

For mmalloc :
Wed Apr 22 00:32:32 1998  Philippe De Muyter  <phdm@macqel.be>

	* mmalloc.h : Include sys/types.h and stdio.h #ifndef HAVE_STDDEF_H.
	* mmprivate.h : Do not handle HAVE_STDDEF_H here, since we include
	mmalloc.h.
	
--- ./gdb/symfile.c	Wed Apr 22 01:00:55 1998
+++ ./gdb/symfile.c	Tue Apr 21 15:42:01 1998
@@ -2543,7 +2543,7 @@ simple_overlay_update_1 (osect)
 	cache_ovly_table[i][SIZE] == size */)
       {
 	read_target_int_array (cache_ovly_table_base + i * TARGET_INT_BYTES,
-			       (int *) &cache_ovly_table[i], 4);
+			       (int *) cache_ovly_table[i], 4);
 	if (cache_ovly_table[i][VMA]  == osect->the_bfd_section->vma &&
 	    cache_ovly_table[i][LMA]  == osect->the_bfd_section->lma /* &&
 	    cache_ovly_table[i][SIZE] == size */)
--- ./gdb/language.c	Wed Apr 22 01:00:57 1998
+++ ./gdb/language.c	Wed Apr 22 00:58:53 1998
@@ -30,11 +30,6 @@
 #include "defs.h"
 #include <ctype.h>
 #include "gdb_string.h"
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 #include "symtab.h"
 #include "gdbtypes.h"
--- ./gdb/tracepoint.c	Wed Apr 22 01:00:59 1998
+++ ./gdb/tracepoint.c	Tue Apr 21 16:17:05 1998
@@ -842,7 +842,7 @@ read_actions (t)
       if (linetype == BADLINE)
 	continue;	/* already warned -- collect another line */
 
-      temp = xmalloc (sizeof (struct action_line));
+      temp = (struct action_line *) xmalloc (sizeof (struct action_line));
       temp->next = NULL;
       temp->action = line;
 
@@ -1191,7 +1191,7 @@ add_memrange (memranges, type, base, len
   if (memranges->next_memrange >= memranges->listsize)
     {
       memranges->listsize *= 2;
-      memranges->list = xrealloc (memranges->list, 
+      memranges->list = (struct memrange *) xrealloc (memranges->list, 
 				  memranges->listsize);
     }
 
@@ -1514,8 +1514,8 @@ encode_actions (t, tdp_actions, step_cou
   memrange_sortmerge (&tracepoint_list); 
   memrange_sortmerge (&stepping_list); 
 
-  *tdp_actions      = stringify_collection_list (&tracepoint_list, &tdp_buff);
-  *stepping_actions = stringify_collection_list (&stepping_list,   &step_buff);
+  *tdp_actions      = stringify_collection_list (&tracepoint_list, tdp_buff);
+  *stepping_actions = stringify_collection_list (&stepping_list,   step_buff);
 }
 
 static char target_buf[2048];
@@ -2438,13 +2438,13 @@ _initialize_tracepoint ()
   if (tracepoint_list.list == NULL)
     {
       tracepoint_list.listsize = 128;
-      tracepoint_list.list = xmalloc 
+      tracepoint_list.list = (struct memrange *) xmalloc 
 	(tracepoint_list.listsize * sizeof (struct memrange));
     }
   if (stepping_list.list == NULL)
     {
       stepping_list.listsize = 128;
-      stepping_list.list = xmalloc 
+      stepping_list.list = (struct memrange *) xmalloc 
 	(stepping_list.listsize * sizeof (struct memrange));
     }
 
--- ./gdb/bcache.h	Wed Apr 22 01:01:01 1998
+++ ./gdb/bcache.h	Tue Apr 21 16:44:51 1998
@@ -47,7 +47,7 @@
    a hashlink struct to hold the next pointer and the data. */
 
 #define BCACHE_DATA_ALIGNMENT \
-	(((char *) &BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
+	(((char *) BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
 
 struct bcache {
   struct obstack cache;
--- ./gdb/dbxread.c	Wed Apr 22 01:01:02 1998
+++ ./gdb/dbxread.c	Tue Apr 21 16:51:19 1998
@@ -638,7 +638,7 @@ dbx_symfile_init (objfile)
   unsigned char size_temp[DBX_STRINGTAB_SIZE_SIZE];
 
   /* Allocate struct to keep track of the symfile */
-  objfile->sym_stab_info = (PTR)
+  objfile->sym_stab_info = (struct dbx_symfile_info *)
     xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
   memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
 
@@ -2638,7 +2638,8 @@ process_one_symbol (type, desc, valu, na
     error ("stabsect_build_psymtabs:  Found stabs (%s), but not string section (%s)",
 	   stab_name, stabstr_name);
 
-  objfile->sym_stab_info = (PTR) xmalloc (sizeof (struct dbx_symfile_info));
+  objfile->sym_stab_info = (struct dbx_symfile_info *)
+    xmalloc (sizeof (struct dbx_symfile_info));
   memset (objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
 
   text_sect = bfd_get_section_by_name (sym_bfd, text_name);
--- ./gdb/coffread.c	Wed Apr 22 01:01:03 1998
+++ ./gdb/coffread.c	Tue Apr 21 16:52:52 1998
@@ -589,7 +589,7 @@ coff_symfile_init (objfile)
      struct objfile *objfile;
 {
   /* Allocate struct to keep track of stab reading. */
-  objfile->sym_stab_info = (PTR)
+  objfile->sym_stab_info = (struct dbx_symfile_info *)
     xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
 
   memset ((PTR) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
--- ./gdb/elfread.c	Wed Apr 22 01:01:04 1998
+++ ./gdb/elfread.c	Tue Apr 21 16:53:26 1998
@@ -597,7 +597,7 @@ elf_symfile_read (objfile, section_offse
   memset ((char *) &ei, 0, sizeof (ei));
 
   /* Allocate struct to keep track of the symfile */
-  objfile->sym_stab_info = (PTR)
+  objfile->sym_stab_info = (struct dbx_symfile_info *)
     xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
   memset ((char *) objfile->sym_stab_info, 0, sizeof (struct dbx_symfile_info));
   make_cleanup (free_elfinfo, (PTR) objfile);
--- ./gdb/stabsread.c	Wed Apr 22 01:01:06 1998
+++ ./gdb/stabsread.c	Tue Apr 21 16:54:50 1998
@@ -1194,7 +1194,8 @@ ref_add (refnum, sym, stabs, value)
     {
       int new_slots = ref_count - ref_chunk * MAX_CHUNK_REFS; 
       int new_chunks = new_slots / MAX_CHUNK_REFS + 1;
-      ref_map = xrealloc (ref_map, REF_MAP_SIZE(ref_chunk + new_chunks));
+      ref_map = (struct ref_map_s *)
+	xrealloc (ref_map, REF_MAP_SIZE(ref_chunk + new_chunks));
       if (!ref_map) 
 	error ("no more free slots in chain\n");
       memset (ref_map + REF_MAP_SIZE(ref_chunk), 0, new_chunks * REF_CHUNK_SIZE);
--- ./gdb/complaints.c	Wed Apr 22 01:01:07 1998
+++ ./gdb/complaints.c	Tue Apr 21 16:55:43 1998
@@ -20,11 +20,6 @@
 #include "defs.h"
 #include "complaints.h"
 #include "gdbcmd.h"
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 
 /* Structure to manage complaints about symbol file contents.  */
 
--- ./gdb/os9kread.c	Wed Apr 22 01:01:08 1998
+++ ./gdb/os9kread.c	Tue Apr 21 17:46:02 1998
@@ -400,7 +400,7 @@ os9k_symfile_init (objfile)
   objfile->auxf1 = minfile;
 
   /* Allocate struct to keep track of the symfile */
-  objfile->sym_stab_info = (PTR)
+  objfile->sym_stab_info = (struct dbx_symfile_info *)
     xmmalloc (objfile -> md, sizeof (struct dbx_symfile_info));
   DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
 
--- ./gdb/utils.c	Wed Apr 22 01:01:09 1998
+++ ./gdb/utils.c	Tue Apr 21 17:53:13 1998
@@ -18,11 +18,6 @@
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
 #include <ctype.h>
 #include "gdb_string.h"
 #ifdef HAVE_UNISTD_H
@@ -2228,7 +2223,7 @@ floatformat_to_doublest (fmt, from, to)
       
       if (newfrom == NULL)
 	{
-	  newfrom = xmalloc (fmt -> totalsize);
+	  newfrom = (unsigned char *) xmalloc (fmt -> totalsize);
 	}
       swapout = newfrom;
       swapin = ufrom;
--- ./mmalloc/mmalloc.h	Wed Apr 22 01:01:10 1998
+++ ./mmalloc/mmalloc.h	Tue Apr 21 15:23:06 1998
@@ -1,12 +1,11 @@
 #ifndef MMALLOC_H
 #define MMALLOC_H 1
 
-/*  FIXME:  If <stddef.h> doesn't exist, you'll need to do something
-            to define size_t before including this file.  Like upgrading
-            to a system with an ANSI C environment. */
-
 #ifdef HAVE_STDDEF_H
 #  include <stddef.h>
+#else
+#  include <sys/types.h>   /* for size_t */
+#  include <stdio.h>       /* for NULL */
 #endif
 
 #include "ansidecl.h"
--- ./mmalloc/mmprivate.h	Wed Apr 22 01:01:10 1998
+++ ./mmalloc/mmprivate.h	Tue Apr 21 15:20:14 1998
@@ -36,12 +36,6 @@
 #  endif
 #endif
 
-#ifdef HAVE_STDDEF_H
-#  include <stddef.h>
-#else
-#  include <sys/types.h>   /* hope for the best -- ANSI C is your friend */
-#endif
-
 #ifndef MIN
 #  define MIN(A, B) ((A) < (B) ? (A) : (B))
 #endif
"mmalloc/mcalloc.c", line 34: NULL undefined
"mmalloc/mcalloc.c", line 34: warning: illegal pointer/integer combination, op !=
"mmalloc/mcalloc.c", line 52: NULL undefined
"mmalloc/mfree.c", line 152: NULL undefined
"mmalloc/mfree.c", line 152: warning: illegal pointer/integer combination, op !=
"mmalloc/mfree.c", line 176: NULL undefined
"mmalloc/mfree.c", line 176: warning: illegal pointer/integer combination, op !=
"mmalloc/mfree.c", line 190: NULL undefined
"mmalloc/mfree.c", line 194: warning: illegal pointer/integer combination, op !=
"mmalloc/mfree.c", line 213: NULL undefined
"mmalloc/mfree.c", line 213: warning: illegal pointer/integer combination, op !=
"mmalloc/mfree.c", line 215: warning: illegal pointer/integer combination, op ==
"mmalloc/mfree.c", line 215: warning: illegal pointer/integer combination, op ==
"mmalloc/mfree.c", line 216: warning: illegal pointer/integer combination, op !=
"mmalloc/mfree.c", line 220: warning: illegal pointer/integer combination, op =
"mmalloc/mfree.c", line 225: warning: illegal pointer/integer combination, op !=
"mmalloc/mfree.c", line 246: NULL undefined
"mmalloc/mmalloc.c", line 46: NULL undefined
"mmalloc/mmalloc.c", line 65: NULL undefined
"mmalloc/mmalloc.c", line 65: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 91: NULL undefined
"mmalloc/mmalloc.c", line 91: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 93: warning: illegal pointer/integer combination, op =
"mmalloc/mmalloc.c", line 105: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 108: warning: illegal pointer/integer combination, op =
"mmalloc/mmalloc.c", line 142: NULL undefined
"mmalloc/mmalloc.c", line 142: warning: illegal pointer/integer combination, op =
"mmalloc/mmalloc.c", line 145: NULL undefined
"mmalloc/mmalloc.c", line 145: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 145: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 147: warning: illegal pointer/integer combination, op !=
"mmalloc/mmalloc.c", line 156: warning: illegal pointer/integer combination, op =
"mmalloc/mmalloc.c", line 180: warning: illegal pointer/integer combination, op !=
"mmalloc/mmalloc.c", line 187: warning: illegal pointer/integer combination, op !=
"mmalloc/mmalloc.c", line 209: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 211: warning: illegal pointer/integer combination, op =
"mmalloc/mmalloc.c", line 221: warning: illegal pointer/integer combination, op !=
"mmalloc/mmalloc.c", line 259: warning: illegal pointer/integer combination, op !=
"mmalloc/mmalloc.c", line 272: warning: illegal pointer/integer combination, op ==
"mmalloc/mmalloc.c", line 274: warning: illegal pointer/integer combination, op =
"mmalloc/mmalloc.c", line 335: NULL undefined
"mmalloc/mmcheck.c", line 82: NULL undefined
"mmalloc/mmcheck.c", line 82: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 82: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 85: warning: illegal pointer/integer combination, op =
"mmalloc/mmcheck.c", line 99: NULL undefined
"mmalloc/mmcheck.c", line 99: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 99: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 100: warning: illegal pointer/integer combination, op =
"mmalloc/mmcheck.c", line 104: warning: illegal pointer/integer combination, op !=
"mmalloc/mmcheck.c", line 124: NULL undefined
"mmalloc/mmcheck.c", line 124: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 124: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 126: warning: illegal pointer/integer combination, op =
"mmalloc/mmcheck.c", line 127: warning: illegal pointer/integer combination, op =
"mmalloc/mmcheck.c", line 128: warning: illegal pointer/integer combination, op =
"mmalloc/mmcheck.c", line 134: warning: illegal pointer/integer combination, op !=
"mmalloc/mmcheck.c", line 182: NULL undefined
"mmalloc/mmcheck.c", line 182: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 182: warning: illegal pointer/integer combination, op ==
"mmalloc/mmcheck.c", line 187: warning: illegal pointer/integer combination, op !=
"mmalloc/mmcheck.c", line 195: warning: illegal pointer/integer combination, op !=
"mmalloc/mmemalign.c", line 32: NULL undefined
"mmalloc/mmemalign.c", line 32: warning: illegal pointer/integer combination, op !=
"mmalloc/mmemalign.c", line 37: warning: illegal pointer/integer combination, op ==
"mmalloc/mmemalign.c", line 37: warning: illegal pointer/integer combination, op ==
"mmalloc/mmemalign.c", line 38: warning: illegal pointer/integer combination, op !=
"mmalloc/mmemalign.c", line 40: warning: illegal pointer/integer combination, op ==
"mmalloc/mmemalign.c", line 46: warning: illegal pointer/integer combination, op ==
"mmalloc/mmemalign.c", line 49: warning: illegal pointer/integer combination, op ==
"mmalloc/mmemalign.c", line 52: warning: illegal pointer/integer combination, op =
"mmalloc/mmstats.c", line 38: NULL undefined
"mmalloc/mmstats.c", line 38: warning: illegal pointer/integer combination, op ==
"mmalloc/mmstats.c", line 38: warning: illegal pointer/integer combination, op ==
"gdb/symfile.c", line 2546: warning: & before array or function: ignored
"gdb/tracepoint.c", line 845: warning: illegal pointer combination, op =
"gdb/tracepoint.c", line 1195: warning: illegal pointer combination, op =
"gdb/tracepoint.c", line 1517: warning: & before array or function: ignored
"gdb/tracepoint.c", line 1518: warning: & before array or function: ignored
"gdb/tracepoint.c", line 2442: warning: illegal pointer combination, op =
"gdb/tracepoint.c", line 2448: warning: illegal pointer combination, op =
"/usr/include/sys/varargs.h", line 42: syntax error
"gdb/bcache.c", line 127: warning: & before array or function: ignored
"gdb/bcache.c", line 128: warning: & before array or function: ignored
"gdb/dbxread.c", line 642: warning: illegal pointer combination, op =
"gdb/dbxread.c", line 2641: warning: illegal pointer combination, op =
"gdb/coffread.c", line 593: warning: illegal pointer combination, op =
"gdb/elfread.c", line 601: warning: illegal pointer combination, op =
"gdb/stabsread.c", line 1197: warning: illegal pointer combination, op =
"/usr/include/sys/varargs.h", line 42: syntax error
"gdb/os9kread.c", line 404: warning: illegal pointer combination, op =
"/usr/include/sys/varargs.h", line 42: syntax error
"gdb/utils.c", line 2231: warning: illegal pointer combination, op =
"gdb/utils.c", line 2226: warning: illegal pointer combination, op =