From 24418cfbac29d947c943d05c14a00e918cff79d7 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 16 Oct 1998 21:45:06 +0000 Subject: [PATCH] 1998-10-16 Jason Molenda (jsm@bugshack.cygnus.com) * command.c copying.c copying.awk core-aout.c core-regset.c corelow.c dcache.c i386-tdep.c i386v4-nat.c i387-tdep.c infcmd.c infptrace.c infrun.c remote.c solib.c symfile.c symmisc.c valarith.c: Add prototypes. * defs.h: Add prototype for utils.c::do_run_cleanups. * gdbtypes.c: Add prototypes. (make_pointer_type): Add braces to remove nested if-else ambiguity. (make_reference_type): Ditto. * printcmd.c (printf_command): Initialize 'f' and 'string' at function startup to suppress possibly-used-before-initialized warning. * remote-utils.c: Add prototypes. (sr_pollchar): Add braces to remove nested if-else ambiguity. * ser-tcp.c: Add prototypes. (wait_for): Add braces to remove nested if-else ambiguity. (tcp_readchar): Ditto. * ser-unix.c: Add prototypes. (get_tty_state): Don't define errno here. (get_tty_state): Don't define errno here. (hardwire_readchar): Only define 't' if we are compiling in a Cygwin environment. * symtab.c: Add prototypes. (find_methods): Add braces to remove nested if-else ambiguity. (search_symbols): Set 'i' to an initial value to suppress a possibly-used-before-initialized warning. * valops.c: Add prototypes. (value_cast): Set 'eltype2' to an initial value to suppress a possibly-used-before-initialized warning. (value_of_variable): Add braces to remove nested if-else ambiguity. (value_of_this): Ditto. * valprint.c: Add prototypes. (print_floating): Add braces to remove nested if-else ambiguity. Looks like a big change, but it is really just a lot of small stuff. In the cases where GCC was flagging a possible use-before-initialized warning on variables, it turned out that these were being used properly but GCC couldn't see that. --- gdb/ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++ gdb/command.c | 25 ++++++++++--------------- gdb/core-aout.c | 4 +++- gdb/core-regset.c | 4 +++- gdb/corelow.c | 4 +++- gdb/dcache.c | 17 +++++++++-------- gdb/gdbtypes.c | 36 +++++++++++++++++++++--------------- gdb/i386v4-nat.c | 14 +++++++++++++- gdb/i387-tdep.c | 6 +++++- gdb/remote-utils.c | 15 ++++++++++----- gdb/ser-tcp.c | 36 +++++++++++++++++++++--------------- gdb/ser-unix.c | 13 ++++++++----- 12 files changed, 148 insertions(+), 68 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9cca78cc4e1..58f69311d0b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,45 @@ +1998-10-16 Jason Molenda (jsm@bugshack.cygnus.com) + + * command.c copying.c copying.awk core-aout.c core-regset.c + corelow.c dcache.c i386-tdep.c i386v4-nat.c i387-tdep.c + infcmd.c infptrace.c infrun.c remote.c solib.c symfile.c + symmisc.c valarith.c: Add prototypes. + + * defs.h: Add prototype for utils.c::do_run_cleanups. + + * gdbtypes.c: Add prototypes. + (make_pointer_type): Add braces to remove nested if-else ambiguity. + (make_reference_type): Ditto. + + * printcmd.c (printf_command): Initialize 'f' and 'string' at + function startup to suppress possibly-used-before-initialized warning. + + * remote-utils.c: Add prototypes. + (sr_pollchar): Add braces to remove nested if-else ambiguity. + + * ser-tcp.c: Add prototypes. + (wait_for): Add braces to remove nested if-else ambiguity. + (tcp_readchar): Ditto. + + * ser-unix.c: Add prototypes. + (get_tty_state): Don't define errno here. + (hardwire_readchar): Only define 't' if we are compiling in a Cygwin + environment. + + * symtab.c: Add prototypes. + (find_methods): Add braces to remove nested if-else ambiguity. + (search_symbols): Set 'i' to an initial value to suppress a + possibly-used-before-initialized warning. + + * valops.c: Add prototypes. + (value_cast): Set 'eltype2' to an initial value to suppress a + possibly-used-before-initialized warning. + (value_of_variable): Add braces to remove nested if-else ambiguity. + (value_of_this): Ditto. + + * valprint.c: Add prototypes. + (print_floating): Add braces to remove nested if-else ambiguity. + Thu Oct 15 19:50:48 1998 Stan Shebs * tm-sp64.h (SETUP_ARBITRARY_FRAME, RAME_SPECIFICATION_DYADIC): diff --git a/gdb/command.c b/gdb/command.c index 10308d55d27..f3686202b18 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -1,5 +1,5 @@ /* Handle lists of commands, their decoding and documentation, for GDB. - Copyright 1986, 1989, 1990, 1991 Free Software Foundation, Inc. + Copyright 1986, 1989, 1990, 1991, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,26 +37,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Prototypes for local functions */ -static void -undef_cmd_error PARAMS ((char *, char *)); +static void undef_cmd_error PARAMS ((char *, char *)); -static void -show_user PARAMS ((char *, int)); +static void show_user PARAMS ((char *, int)); -static void -show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *)); +static void show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *)); -static void -make_command PARAMS ((char *, int)); +static void make_command PARAMS ((char *, int)); -static void -shell_escape PARAMS ((char *, int)); +static void shell_escape PARAMS ((char *, int)); -static int -parse_binary_operation PARAMS ((char *)); +static int parse_binary_operation PARAMS ((char *)); -static void -print_doc_line PARAMS ((GDB_FILE *, char *)); +static void print_doc_line PARAMS ((GDB_FILE *, char *)); + +void _initialize_command PARAMS ((void)); /* Add element named NAME. CLASS is the top level category into which commands are broken down diff --git a/gdb/core-aout.c b/gdb/core-aout.c index 68dc1d4e05e..49cab6349ab 100644 --- a/gdb/core-aout.c +++ b/gdb/core-aout.c @@ -1,5 +1,5 @@ /* Extract registers from a "standard" core file, for GDB. - Copyright (C) 1988-1995 Free Software Foundation, Inc. + Copyright (C) 1988-1998 Free Software Foundation, Inc. This file is part of GDB. @@ -56,6 +56,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static void fetch_core_registers PARAMS ((char *, unsigned, int, CORE_ADDR)); +void _initialize_core_aout PARAMS ((void)); + /* Extract the register values out of the core file and store them where `read_register' will find them. diff --git a/gdb/core-regset.c b/gdb/core-regset.c index 144bba3141f..d925abea746 100644 --- a/gdb/core-regset.c +++ b/gdb/core-regset.c @@ -1,5 +1,5 @@ /* Machine independent GDB support for core files on systems using "regsets". - Copyright 1993-1996 Free Software Foundation, Inc. + Copyright 1993-1998 Free Software Foundation, Inc. This file is part of GDB. @@ -49,6 +49,8 @@ regardless of whether or not the actual target has floating point hardware. static void fetch_core_registers PARAMS ((char *, unsigned, int, CORE_ADDR)); +void _initialize_core_regset PARAMS ((void)); + /* GLOBAL FUNCTION diff --git a/gdb/corelow.c b/gdb/corelow.c index 710caa0435a..831b4b29539 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -56,6 +56,8 @@ static void add_to_thread_list PARAMS ((bfd *, asection *, PTR)); static int ignore PARAMS ((CORE_ADDR, char *)); +void _initialize_corelow PARAMS ((void)); + /* Link a new core_fns into the global core_file_fns list. Called on gdb startup by the _initialize routine in each core file register reader, to register information about each format the the reader is prepared to @@ -426,7 +428,7 @@ struct target_ops core_ops = { int coreops_suppress_target; void -_initialize_corelow() +_initialize_corelow () { if (!coreops_suppress_target) add_target (&core_ops); diff --git a/gdb/dcache.c b/gdb/dcache.c index 8020797691d..a97a940a4a6 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -1,7 +1,7 @@ /* Caching code. Typically used by remote back ends for caching remote memory. - Copyright 1992, 1993, 1995 Free Software Foundation, Inc. + Copyright 1992, 1993, 1995, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -148,14 +148,14 @@ struct dcache_struct int cache_has_stuff; } ; -static int -dcache_poke_byte PARAMS ((DCACHE *dcache, CORE_ADDR addr, char *ptr)); +static int dcache_poke_byte PARAMS ((DCACHE *dcache, CORE_ADDR addr, + char *ptr)); -static int -dcache_peek_byte PARAMS ((DCACHE *dcache, CORE_ADDR addr, char *ptr)); +static int dcache_peek_byte PARAMS ((DCACHE *dcache, CORE_ADDR addr, + char *ptr)); -static struct dcache_block * -dcache_hit PARAMS ((DCACHE *dcache, CORE_ADDR addr)); +static struct dcache_block *dcache_hit PARAMS ((DCACHE *dcache, + CORE_ADDR addr)); static int dcache_write_line PARAMS ((DCACHE *dcache,struct dcache_block *db)); @@ -165,12 +165,13 @@ static int dcache_writeback PARAMS ((DCACHE *dcache)); static void dcache_info PARAMS ((char *exp, int tty)); +void _initialize_dcache PARAMS ((void)); + int remote_dcache = 0; DCACHE *last_cache; /* Used by info dcache */ - /* Free all the data cache blocks, thus discarding all cached data. */ void diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d55a87a0bc7..6601d9dcdf4 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1,5 +1,5 @@ /* Support routines for manipulating internal types for GDB. - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. This file is part of GDB. @@ -78,6 +78,8 @@ static void print_arg_types PARAMS ((struct type **, int)); static void dump_fn_fieldlists PARAMS ((struct type *, int)); static void print_cplus_stuff PARAMS ((struct type *, int)); +void _initialize_gdbtypes PARAMS ((void)); + /* Alloc a new type structure and fill it with some defaults. If OBJFILE is non-NULL, then allocate the space for the type structure in that objfile's type_obstack. */ @@ -127,13 +129,15 @@ make_pointer_type (type, typeptr) ntype = TYPE_POINTER_TYPE (type); if (ntype) - if (typeptr == 0) - return ntype; /* Don't care about alloc, and have new type. */ - else if (*typeptr == 0) - { - *typeptr = ntype; /* Tracking alloc, and we have new type. */ - return ntype; - } + { + if (typeptr == 0) + return ntype; /* Don't care about alloc, and have new type. */ + else if (*typeptr == 0) + { + *typeptr = ntype; /* Tracking alloc, and we have new type. */ + return ntype; + } + } if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -192,13 +196,15 @@ make_reference_type (type, typeptr) ntype = TYPE_REFERENCE_TYPE (type); if (ntype) - if (typeptr == 0) - return ntype; /* Don't care about alloc, and have new type. */ - else if (*typeptr == 0) - { - *typeptr = ntype; /* Tracking alloc, and we have new type. */ - return ntype; - } + { + if (typeptr == 0) + return ntype; /* Don't care about alloc, and have new type. */ + else if (*typeptr == 0) + { + *typeptr = ntype; /* Tracking alloc, and we have new type. */ + return ntype; + } + } if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { diff --git a/gdb/i386v4-nat.c b/gdb/i386v4-nat.c index 965f6321ef2..ea84c651c46 100644 --- a/gdb/i386v4-nat.c +++ b/gdb/i386v4-nat.c @@ -1,5 +1,5 @@ /* Native-dependent code for SVR4 Unix running on i386's, for GDB. - Copyright 1988, 1989, 1991, 1992, 1996 Free Software Foundation, Inc. + Copyright 1988, 1989, 1991, 1992, 1996, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -18,11 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "value.h" #ifdef HAVE_SYS_REG_H #include #endif + #ifdef HAVE_SYS_PROCFS_H #include @@ -83,6 +85,16 @@ static int regmap[] = DS, ES, FS, GS, }; +/* Prototypes for local functions */ + +void fill_gregset PARAMS ((gregset_t *, int)); + +void supply_gregset PARAMS ((gregset_t *)); + +void supply_fpregset PARAMS ((fpregset_t *)); + +void fill_fpregset PARAMS ((fpregset_t *, int)); + /* FIXME: These routine absolutely depends upon (NUM_REGS - NUM_FREGS) being less than or equal to the number of registers that can be stored diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 6b69405a7df..869ab9a33b8 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -1,5 +1,5 @@ /* Intel 387 floating point stuff. - Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1991, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -24,6 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcore.h" #include "floatformat.h" +void i387_to_double PARAMS ((char *, char *)); + +void double_to_i387 PARAMS ((char *, char *)); + /* FIXME: Eliminate these routines when we have the time to change all the callers. */ diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c index 043dd51486e..7219255bb6a 100644 --- a/gdb/remote-utils.c +++ b/gdb/remote-utils.c @@ -1,6 +1,6 @@ /* Generic support for remote debugging interfaces. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 1994, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -50,6 +50,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "inferior.h" /* for generic_mourn_inferior */ #include "remote-utils.h" + +void _initialize_sr_support PARAMS ((void)); + struct _sr_settings sr_settings = { 4, /* timeout: remote-hms.c had 2 @@ -244,10 +247,12 @@ sr_pollchar() if (buf == SERIAL_TIMEOUT) buf = 0; if (sr_get_debug() > 0) - if (buf) - printf_unfiltered ("%c", buf); - else - printf_unfiltered (""); + { + if (buf) + printf_unfiltered ("%c", buf); + else + printf_unfiltered (""); + } return buf & 0x7f; } diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 279cbd0d718..c55133760fa 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -1,5 +1,5 @@ /* Serial interface for raw TCP connections on Un*x like systems - Copyright 1992, 1993 Free Software Foundation, Inc. + Copyright 1992, 1993, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -54,6 +54,8 @@ static int tcp_noflush_set_tty_state PARAMS ((serial_t, serial_ttystate, serial_ttystate)); static void tcp_print_tty_state PARAMS ((serial_t, serial_ttystate)); +void _initialize_ser_tcp PARAMS ((void)); + /* Open up a raw tcp socket */ static int @@ -183,7 +185,7 @@ tcp_raw(scb) */ static int -wait_for(scb, timeout) +wait_for (scb, timeout) serial_t scb; int timeout; { @@ -208,12 +210,14 @@ wait_for(scb, timeout) numfds = select(scb->fd+1, &readfds, 0, &exceptfds, 0); if (numfds <= 0) - if (numfds == 0) - return SERIAL_TIMEOUT; - else if (errno == EINTR) - continue; - else - return SERIAL_ERROR; /* Got an error from select or poll */ + { + if (numfds == 0) + return SERIAL_TIMEOUT; + else if (errno == EINTR) + continue; + else + return SERIAL_ERROR; /* Got an error from select or poll */ + } return 0; } @@ -225,7 +229,7 @@ wait_for(scb, timeout) dead, or -3 for any other error (see errno in that case). */ static int -tcp_readchar(scb, timeout) +tcp_readchar (scb, timeout) serial_t scb; int timeout; { @@ -247,12 +251,14 @@ tcp_readchar(scb, timeout) } if (scb->bufcnt <= 0) - if (scb->bufcnt == 0) - return SERIAL_TIMEOUT; /* 0 chars means timeout [may need to - distinguish between EOF & timeouts - someday] */ - else - return SERIAL_ERROR; /* Got an error from read */ + { + if (scb->bufcnt == 0) + return SERIAL_TIMEOUT; /* 0 chars means timeout [may need to + distinguish between EOF & timeouts + someday] */ + else + return SERIAL_ERROR; /* Got an error from read */ + } scb->bufcnt--; scb->bufp = scb->buf; diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index 99d378e4e57..f279c94cfdb 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -83,6 +83,8 @@ static int hardwire_flush_input PARAMS ((serial_t)); static int hardwire_send_break PARAMS ((serial_t)); static int hardwire_setstopbits PARAMS ((serial_t, int)); +void _initialize_ser_hardwire PARAMS ((void)); + #ifdef __CYGWIN32__ extern void (*ui_loop_hook) PARAMS ((int)); #endif @@ -102,13 +104,11 @@ hardwire_open(scb, name) } static int -get_tty_state(scb, state) +get_tty_state (scb, state) serial_t scb; struct hardwire_ttystate *state; { #ifdef HAVE_TERMIOS - extern int errno; - if (tcgetattr(scb->fd, &state->termios) < 0) return -1; @@ -546,11 +546,14 @@ wait_for(scb, timeout) char if successful. Returns SERIAL_TIMEOUT if timeout expired, EOF if line dropped dead, or SERIAL_ERROR for any other error (see errno in that case). */ static int -hardwire_readchar(scb, timeout) +hardwire_readchar (scb, timeout) serial_t scb; int timeout; { - int status, t; + int status; +#ifdef __CYGWIN32__ + int t; +#endif if (scb->bufcnt-- > 0) return *scb->bufp++; -- 2.30.2