This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


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

[PATCH] Some compiler warnings removed



Here's my share of shutting up "gcc -Wall -W".  Is "foo = foo;" an
okay solution for unused argument foo?

These diffs are against Feb 17 snapshot.  I hope they are still
relevant and apply cleanly.

2000-02-23  Eli Zaretskii  <eliz@is.elta.co.il>

	* utils.c [__GO32__]: Include pc.h, for prototypes of ScreenCols
	and ScreenRows.

	* ser-go32.c: Include string.h, for prototype of strncasecmp.
	(dpmi_regs, dpmi_sregs): Remove unused variables.
	(dos_flush_input): Return a value, to prevent compiler warning.

	* main.c (captured_command_loop): Prevent gcc from complaining
	about unused argument.

	* gdbtypes.c (count_virtual_fns): Make sure vfuncs is initialized
	to zero.

	* expprint.c (dump_prefix_expression): Use %ld in format and cast
	sizeof(union exp_element) to long, to prevent GCC from complaining
	about format/argument mismatch.
	(dump_postfix_expression): Likewise.

	* blockframe.c (nonnull_frame_chain_valid)
	(pc_in_call_dummy_before_text_end)
	(pc_in_call_dummy_after_text_end) 
	(pc_in_call_dummy_at_entry_point, generic_pc_in_call_dummy):
	Prevent gcc from complaining about unused arguments.

--- gdb/blockframe.c~0	Wed Dec 22 21:45:02 1999
+++ gdb/blockframe.c	Wed Feb 23 16:51:44 2000
@@ -70,6 +70,7 @@ nonnull_frame_chain_valid (chain, thisfr
      CORE_ADDR chain;
      struct frame_info *thisframe;
 {
+  thisframe = thisframe;
   return ((chain) != 0);
 }
 
@@ -1035,6 +1036,7 @@ pc_in_call_dummy_before_text_end (pc, sp
      CORE_ADDR sp;
      CORE_ADDR frame_address;
 {
+  sp = frame_address;
   return ((pc) >= text_end - CALL_DUMMY_LENGTH
 	  && (pc) <= text_end + DECR_PC_AFTER_BREAK);
 }
@@ -1045,6 +1047,7 @@ pc_in_call_dummy_after_text_end (pc, sp,
      CORE_ADDR sp;
      CORE_ADDR frame_address;
 {
+  sp = frame_address;
   return ((pc) >= text_end
 	  && (pc) <= text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK);
 }
@@ -1084,6 +1087,7 @@ pc_in_call_dummy_at_entry_point (pc, sp,
      CORE_ADDR sp;
      CORE_ADDR frame_address;
 {
+  sp = frame_address;
   return ((pc) >= CALL_DUMMY_ADDRESS ()
 	  && (pc) <= (CALL_DUMMY_ADDRESS () + DECR_PC_AFTER_BREAK));
 }
@@ -1158,6 +1162,7 @@ generic_pc_in_call_dummy (pc, sp, fp)
      CORE_ADDR sp;
      CORE_ADDR fp;
 {
+  fp = fp;
   /* if find_dummy_frame succeeds, then PC is in a call dummy */
   /* Note: SP and not FP is passed on. */
   return (generic_find_dummy_frame (pc, sp) != 0);
--- gdb/expprint.c~0	Wed Feb  2 00:21:06 2000
+++ gdb/expprint.c	Wed Feb 23 17:11:22 2000
@@ -710,9 +710,9 @@ dump_prefix_expression (exp, stream, not
     print_expression (exp, stream);
   else
     fprintf_filtered (stream, "Type printing not yet supported....");
-  fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %d bytes each.\n",
+  fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
 		    exp->language_defn->la_name, exp->nelts,
-		    sizeof (union exp_element));
+		    (long) sizeof (union exp_element));
   fprintf_filtered (stream, "\t%5s  %20s  %16s  %s\n", "Index", "Opcode",
 		    "Hex Value", "String Value");
   for (elt = 0; elt < exp->nelts; elt++)
@@ -986,9 +986,9 @@ dump_postfix_expression (exp, stream, no
     print_expression (exp, stream);
   else
     fputs_filtered ("Type printing not yet supported....", stream);
-  fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %d bytes each.\n",
+  fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
 		    exp->language_defn->la_name, exp->nelts,
-		    sizeof (union exp_element));
+		    (long) sizeof (union exp_element));
   fputs_filtered ("\n", stream);
 
   for (elt = 0; elt < exp->nelts;)
--- gdb/gdbtypes.c~0	Tue Dec 14 01:05:30 1999
+++ gdb/gdbtypes.c	Wed Feb 23 17:13:34 2000
@@ -2041,7 +2041,7 @@ count_virtual_fns (dclass)
      struct type *dclass;
 {
   int fn, oi;			/* function and overloaded instance indices */
-  int vfuncs;			/* count to return */
+  int vfuncs = 0;		/* count to return */
 
   /* recurse on bases that can share virtual table */
   struct type *pbc = primary_base_class (dclass);
--- gdb/i386-tdep.c~0	Tue Oct 19 02:46:36 1999
+++ gdb/i386-tdep.c	Wed Feb 23 12:17:20 2000
@@ -702,9 +702,9 @@ i386_extract_return_value (type, regbuf,
      char regbuf[REGISTER_BYTES];
      char *valbuf;
 {
-  /* On AIX and i386 GNU/Linux, floating point values are returned in
-     floating point registers.  */
-#if defined(I386_AIX_TARGET) || defined(I386_GNULINUX_TARGET)
+  /* On AIX, i386 GNU/Linux and DJGPP, floating point values are
+     returned in floating point registers.  */
+#if defined(I386_AIX_TARGET) || defined(I386_GNULINUX_TARGET) || defined(I386_DJGPP_TARGET)
   if (TYPE_CODE_FLT == TYPE_CODE (type))
     {
       double d;
@@ -720,7 +720,7 @@ i386_extract_return_value (type, regbuf,
       store_floating (valbuf, TYPE_LENGTH (type), d);
     }
   else
-#endif /* I386_AIX_TARGET || I386_GNULINUX_TARGET*/
+#endif /* I386_AIX_TARGET || I386_GNULINUX_TARGET || I386_DJGPP_TARGET */
     {
 #if defined(LOW_RETURN_REGNUM)
       int len = TYPE_LENGTH (type);
--- gdb/main.c~0	Mon Feb  7 00:19:34 2000
+++ gdb/main.c	Wed Feb 23 16:48:54 2000
@@ -93,6 +93,7 @@ extern char *external_editor_command;
 static int
 captured_command_loop (void *data)
 {
+  data = data;
   if (command_loop_hook == NULL)
     command_loop ();
   else
--- gdb/ser-go32.c~0	Wed Feb  2 00:21:10 2000
+++ gdb/ser-go32.c	Wed Feb 23 17:18:50 2000
@@ -127,15 +127,12 @@
 #define	MSR_DDSR	0x02
 #define	MSR_DCTS	0x01
 
+#include <string.h>
 #include <dos.h>
 #include <go32.h>
 #include <dpmi.h>
 typedef unsigned long u_long;
 
-/* DPMI Communication */
-static union REGS dpmi_regs;
-static struct SREGS dpmi_sregs;
-
 /* 16550 rx fifo trigger point */
 #define FIFO_TRIGGER	FIFO_TRIGGER_4
 
@@ -693,6 +690,7 @@ dos_flush_input (scb)
   if (port->fifo)
     outb (port, com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_TRIGGER);
   enable ();
+  return 0;
 }
 
 static void
--- gdb/utils.c~0	Wed Feb  2 00:21:10 2000
+++ gdb/utils.c	Wed Feb 23 17:45:36 2000
@@ -31,6 +31,10 @@
 #include <term.h>
 #endif
 
+#ifdef __GO32__
+#include <pc.h>
+#endif
+
 /* SunOS's curses.h has a '#define reg register' in it.  Thank you Sun. */
 #ifdef reg
 #undef reg

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