This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: -Wmissing-prototypes ...
- To: gdb at sourceware dot cygnus dot com
- Subject: Re: -Wmissing-prototypes ...
- From: Eli Zaretskii <eliz at gnu dot org>
- Date: Thu, 2 Dec 1999 09:14:31 -0500
- CC: Andrew Cagney <ac131313 at cygnus dot com>, DJ Delorie <dj at delorie dot com>
- References: <37E5E508.D56E054C@cygnus.com> <37CB6DBE.2083662F@cygnus.com>
> My current list is:
>
> --enable-build-warnings=-Werror\
> ,-Wimplicit\
> ,-Wreturn-type\
> ,-Wcomment\
> ,-Wtrigraphs\
> ,-Wformat\
> ,-Wparentheses\
> ,-Wpointer-arith\
> ,-Wmissing-prototypes\
> ,-Woverloaded-virtual\
Here are the patches for go32-nat.c to allow it to compile with all
kinds of -Wfoo switches (I added switches beyond those mentioned above).
While working on this, I found out that defs.h redeclares several
library functions, like getenv, fclose and atof, because symbols like
GETENV_PROVIDED etc. aren't defined anywhere; this causes GCC to
complain (under the full list of warning options). What header should
define those for a particular host?
--- gdb/go32-nat.~17 Wed Dec 1 20:02:36 1999
+++ gdb/go32-nat.c Wed Dec 1 20:57:06 1999
@@ -29,6 +29,7 @@
#include "gdbcore.h"
#include "command.h"
#include "floatformat.h"
+#include "language.h"
#include <stdio.h> /* required for __DJGPP_MINOR__ */
#include <stdlib.h>
@@ -164,42 +165,47 @@
#define SOME_PID 42
static int prog_has_started = 0;
-static void print_387_status (unsigned short status, struct env387 *ep);
-static void go32_open (char *name, int from_tty);
-static void go32_close (int quitting);
-static void go32_attach (char *args, int from_tty);
-static void go32_detach (char *args, int from_tty);
-static void go32_resume (int pid, int step, enum target_signal siggnal);
-static int go32_wait (int pid, struct target_waitstatus *status);
-static void go32_fetch_registers (int regno);
-static void store_register (int regno);
-static void go32_store_registers (int regno);
+static void print_387_status (unsigned, struct env387 *);
+static void go32_open (char *, int);
+static void go32_close (int);
+static void go32_attach (char *, int);
+static void go32_detach (char *, int);
+static void go32_resume (int, int, enum target_signal);
+static int go32_wait (int, struct target_waitstatus *);
+static void go32_fetch_registers (int);
+static void store_register (int);
+static void go32_store_registers (int);
static void go32_prepare_to_store (void);
-static int go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
- int write, struct target_ops *target);
-static void go32_files_info (struct target_ops *target);
+static int go32_xfer_memory (CORE_ADDR, char *, int,
+ int, struct target_ops *);
+static void go32_files_info (struct target_ops *);
static void go32_stop (void);
static void go32_kill_inferior (void);
-static void go32_create_inferior (char *exec_file, char *args, char **env);
+static void go32_create_inferior (char *, char *, char **);
static void cleanup_dregs (void);
static void go32_mourn_inferior (void);
static int go32_can_run (void);
static void ignore (void);
-static void ignore2 (char *a, int b);
-static int go32_insert_aligned_watchpoint (CORE_ADDR waddr, CORE_ADDR addr,
- int len, int rw);
-static int go32_remove_aligned_watchpoint (CORE_ADDR waddr, CORE_ADDR addr,
- int len, int rw);
-static int go32_handle_nonaligned_watchpoint (wp_op what, CORE_ADDR waddr,
- CORE_ADDR addr, int len, int rw);
+static int go32_insert_aligned_watchpoint (CORE_ADDR, CORE_ADDR, int, int);
+static int go32_remove_aligned_watchpoint (CORE_ADDR, CORE_ADDR, int, int);
+static int go32_handle_nonaligned_watchpoint (wp_op, CORE_ADDR, CORE_ADDR,
+ int, int);
static struct target_ops go32_ops;
static void go32_terminal_init (void);
static void go32_terminal_inferior (void);
static void go32_terminal_ours (void);
+int go32_insert_watchpoint (int, CORE_ADDR, int, int);
+int go32_remove_watchpoint (int, CORE_ADDR, int, int);
+int go32_region_ok_for_watchpoint (CORE_ADDR, int);
+CORE_ADDR go32_stopped_by_watchpoint (int, int);
+int go32_insert_hw_breakpoint (CORE_ADDR, CORE_ADDR);
+int go32_remove_hw_breakpoint (CORE_ADDR, CORE_ADDR);
+
+
static void
-print_387_status (unsigned short status, struct env387 *ep)
+print_387_status (unsigned status, struct env387 *ep)
{
int i;
int bothstatus;
@@ -221,7 +227,7 @@
print_387_status_word (ep->status);
}
- print_387_control_word (ep->control & 0xffff);
+ print_387_control_word ((unsigned)ep->control & 0xffff);
/* Other platforms say "last exception", but that's not true: the
FPU stores the last non-control instruction there. */
printf_unfiltered ("last FP instruction: ");
@@ -229,7 +235,8 @@
are not stored by the FPU (since these bits are the same for all
floating-point instructions). */
printf_unfiltered ("opcode %s; ",
- local_hex_string (ep->opcode ? (ep->opcode|0xd800) : 0));
+ local_hex_string (ep->opcode
+ ? (unsigned)(ep->opcode|0xd800) : 0));
printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg));
printf_unfiltered ("%s; ", local_hex_string (ep->eip));
printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg));
@@ -244,7 +251,7 @@
order, beginning with ST(0). Since we need to print them in
their physical order, we have to remap them. */
int regno = fpreg - top;
- long double val;
+ long double ldval;
if (regno < 0)
regno += 8;
@@ -272,9 +279,9 @@
printf_unfiltered ("%02x", ep->regs[regno][i]);
REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM+regno, builtin_type_long_double,
- &ep->regs[regno], &val);
+ &ep->regs[regno], &ldval);
- printf_unfiltered (" %.19LG\n", val);
+ printf_unfiltered (" %.19LG\n", ldval);
}
}
@@ -381,7 +388,7 @@
TARGET_SIGNAL_QUIT, 0x7a,
TARGET_SIGNAL_ALRM, 0x78, /* triggers SIGTIMR */
TARGET_SIGNAL_PROF, 0x78,
- -1, -1
+ (enum target_signal)-1, -1
};
static void
@@ -420,7 +427,8 @@
if (siggnal != TARGET_SIGNAL_0 && siggnal != TARGET_SIGNAL_TRAP)
{
- for (i = 0, resume_signal = -1; excepn_map[i].gdb_sig != -1; i++)
+ for (i = 0, resume_signal = -1;
+ excepn_map[i].gdb_sig != (enum target_signal)-1; i++)
if (excepn_map[i].gdb_sig == siggnal)
{
resume_signal = excepn_map[i].djgpp_excepno;
@@ -439,7 +447,7 @@
{
int i;
unsigned char saved_opcode;
- unsigned long INT3_addr;
+ unsigned long INT3_addr = 0L;
int stepping_over_INT = 0;
a_tss.tss_eflags &= 0xfeff; /* reset the single-step flag (TF) */
@@ -594,14 +602,14 @@
static void
go32_store_registers (int regno)
{
- int r;
+ unsigned r;
if (regno >= 0)
store_register (regno);
else
{
for (r = 0; r < sizeof (regno_mapping) / sizeof (regno_mapping[0]); r++)
- store_register (r);
+ store_register ((int)r);
}
}
@@ -611,12 +619,12 @@
}
static int
-go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int to_write,
struct target_ops *target)
{
- if (write)
+ if (to_write)
{
- if (write_child (memaddr, myaddr, len))
+ if (write_child (memaddr, myaddr, (unsigned)len))
{
return 0;
}
@@ -627,7 +635,7 @@
}
else
{
- if (read_child (memaddr, myaddr, len))
+ if (read_child (memaddr, myaddr, (unsigned)len))
{
return 0;
}
@@ -820,12 +828,13 @@
#define SHOW_DR(text,len) \
do { \
if (!getenv ("GDB_SHOW_DR")) break; \
- fprintf(stderr,"%08x %08x ",edi.dr[7],edi.dr[6]); \
- fprintf(stderr,"%08x %d %08x %d ", \
+ fprintf(stderr,"%08lx %08lx ",edi.dr[7],edi.dr[6]); \
+ fprintf(stderr,"%08lx %d %08lx %d ", \
edi.dr[0],dr_ref_count[0],edi.dr[1],dr_ref_count[1]); \
- fprintf(stderr,"%08x %d %08x %d ", \
+ fprintf(stderr,"%08lx %d %08lx %d ", \
edi.dr[2],dr_ref_count[2],edi.dr[3],dr_ref_count[3]); \
- fprintf(stderr,(len)?"(%s:%d)\n":"(%s)\n",#text,len); \
+ if (len) fprintf(stderr,"(%s:%d)\n",#text,len); \
+ else fprintf(stderr,"(%s)\n",#text); \
} while (0)
#else
#define SHOW_DR(text,len) do {} while (0)
@@ -861,7 +870,7 @@
int len, int rw)
{
int i;
- int read_write_bits, len_bits;
+ unsigned read_write_bits, len_bits;
/* Values of rw: 0 - write, 1 - read, 2 - access (read and write).
However, x86 doesn't support read-only data breakpoints. */
@@ -992,7 +1001,7 @@
int len, int rw)
{
int i;
- int read_write_bits, len_bits;
+ unsigned read_write_bits, len_bits;
/* Values of rw: 0 - write, 1 - read, 2 - access (read and write).
However, x86 doesn't support read-only data breakpoints. */
@@ -1105,9 +1114,6 @@
go32_insert_hw_breakpoint (CORE_ADDR addr, CORE_ADDR shadow)
{
int i;
- int read_write_bits, len_bits;
- int free_debug_register;
- int register_number;
/* Look for an occupied debug register with the same address and the
same RW and LEN definitions. If we find one, we can use it for