some gcc lint
authorK. Richard Pixley <rich@cygnus>
Wed, 8 Sep 1993 20:15:34 +0000 (20:15 +0000)
committerK. Richard Pixley <rich@cygnus>
Wed, 8 Sep 1993 20:15:34 +0000 (20:15 +0000)
gdb/ChangeLog
gdb/stabsread.c
gdb/stack.c
gdb/symfile.c
gdb/thread.c
gdb/typeprint.c
gdb/values.c

index 4dd76a7..2ac2c9f 100644 (file)
@@ -1,3 +1,25 @@
+Wed Sep  8 13:01:10 1993  K. Richard Pixley  (rich@cygnus.com)
+
+       Gcc lint.
+       * stack.c (print_frame_info): remove unused variable numargs.
+         (parse_frame_specification): remove unused variables arg1, arg2,
+         arg3.
+         (return_command): initialize return_value.
+       * symfile.c (cashier_psymtab): initialize pprev.
+       * symtab.c (find_pc_psymbol): initialize best.
+         (lookup_symbol): initialize s.
+         (make_symbol_completion_list): initialize quote_pos.
+       * thread.c: include command.h.
+         (thread_info): static declaration removed; unused.
+         (info_threads_command): fix == vs = typo.
+       * typeprint.c (whatis_exp): initialize old_chain.
+       * valprint.c (val_print_string): remove unused variable
+         first_addr_err.  Initialize old_chain.
+         (_initialize_valprint): white space comment change.
+       * values.c (show_values): rewrite if statement to avoid empty
+         body.
+         (vb_match): remove unused variable fieldtype_target_type.
+
 Wed Sep  8 10:21:33 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * Makefile.in (mipsread.o): Depend on $(bfd_h).
index 1841a76..ed820bb 100644 (file)
@@ -1544,7 +1544,7 @@ rs6000_builtin_type (typenum)
 #define NUMBER_RECOGNIZED 30
   /* This includes an empty slot for type number -0.  */
   static struct type *negative_types[NUMBER_RECOGNIZED + 1];
-  struct type *rettype;
+  struct type *rettype = NULL;
 
   if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED)
     {
@@ -3182,7 +3182,7 @@ read_range_type (pp, typenums, objfile)
       char got_signed = 0;
       char got_unsigned = 0;
       /* Number of bits in the type.  */
-      int nbits;
+      int nbits = 0;
 
       /* Range from 0 to <large number> is an unsigned large integral type.  */
       if ((n2bits == 0 && n2 == 0) && n3bits != 0)
index 4fd734e..d16bbd6 100644 (file)
@@ -160,7 +160,6 @@ print_frame_info (fi, level, source, args)
   struct symbol *func;
   register char *funname = 0;
   enum language funlang = language_unknown;
-  int numargs;
   char buf[MAX_REGISTER_RAW_SIZE];
   CORE_ADDR sp;
 
@@ -202,8 +201,16 @@ print_frame_info (fi, level, source, args)
       return;
     }
 
-  sal = find_pc_line (fi->pc,
-                     fi->next != NULL && fi->next->signal_handler_caller == 0);
+  /* If fi is not the innermost frame, that normally means that fi->pc
+     points to *after* the call instruction, and we want to get the line
+     containing the call, never the next line.  But if the next frame is
+     a signal_handler_caller frame, then the next frame was not entered
+     as the result of a call, and we want to get the line containing
+     fi->pc.  */
+  sal =
+    find_pc_line (fi->pc,
+                 fi->next != NULL && fi->next->signal_handler_caller == 0);
+
   func = find_pc_function (fi->pc);
   if (func)
     {
@@ -321,7 +328,6 @@ parse_frame_specification (frame_exp)
      char *frame_exp;
 {
   int numargs = 0;
-  int arg1, arg2, arg3;
 #define        MAXARGS 4
   int args[MAXARGS];
   
@@ -927,12 +933,14 @@ print_frame_arg_vars (frame, stream)
   for (i = 0; i < nsyms; i++)
     {
       sym = BLOCK_SYM (b, i);
-      if (SYMBOL_CLASS (sym) == LOC_ARG
-         || SYMBOL_CLASS (sym) == LOC_LOCAL_ARG
-         || SYMBOL_CLASS (sym) == LOC_REF_ARG
-         || SYMBOL_CLASS (sym) == LOC_REGPARM
-         || SYMBOL_CLASS (sym) == LOC_REGPARM_ADDR)
+      switch (SYMBOL_CLASS (sym))
        {
+       case LOC_ARG:
+       case LOC_LOCAL_ARG:
+       case LOC_REF_ARG:
+       case LOC_REGPARM:
+       case LOC_REGPARM_ADDR:
+       case LOC_BASEREG_ARG:
          values_printed = 1;
          fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
          fputs_filtered (" = ", stream);
@@ -952,6 +960,11 @@ print_frame_arg_vars (frame, stream)
                        b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
          print_variable_value (sym2, frame, stream);
          fprintf_filtered (stream, "\n");
+         break;
+
+       default:
+         /* Don't worry about things which aren't arguments.  */
+         break;
        }
     }
 
@@ -1190,7 +1203,7 @@ return_command (retval_exp, from_tty)
   FRAME_ADDR selected_frame_addr;
   CORE_ADDR selected_frame_pc;
   FRAME frame;
-  value return_value;
+  value return_value = NULL;
 
   if (selected_frame == NULL)
     error ("No selected frame.");
index d68ac20..c2ea7dc 100644 (file)
@@ -1195,7 +1195,7 @@ static void
 cashier_psymtab (pst)
      struct partial_symtab *pst;
 {
-  struct partial_symtab *ps, *pprev;
+  struct partial_symtab *ps, *pprev = NULL;
   int i;
 
   /* Find its previous psymtab in the chain */
index ea5173f..6c2b8eb 100644 (file)
@@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "value.h"
 #include "target.h"
 #include "thread.h"
+#include "command.h"
 
 #include <sys/types.h>
 #include <signal.h>
@@ -44,8 +45,6 @@ struct thread_info
 static struct thread_info *thread_list = NULL;
 static int highest_thread_num;
 
-static void thread_info PARAMS ((void));
-
 static void thread_command PARAMS ((char * tidstr, int from_tty));
 
 static void prune_threads PARAMS ((void));
@@ -159,7 +158,7 @@ info_threads_command (arg, from_tty)
       if (target_has_execution
          && kill (tp->pid, 0) == -1)
        {
-         tp->pid == -1;        /* Mark it as dead */
+         tp->pid = -1; /* Mark it as dead */
          continue;
        }
 
index 85be5e9..5e13e07 100644 (file)
@@ -73,7 +73,7 @@ whatis_exp (exp, show)
 {
   struct expression *expr;
   register value val;
-  register struct cleanup *old_chain;
+  register struct cleanup *old_chain = NULL;
 
   if (exp)
     {
index 65ecb23..8890c8e 100644 (file)
@@ -334,11 +334,9 @@ show_values (num_exp, from_tty)
 
   if (num_exp)
     {
-      if (num_exp[0] == '+' && num_exp[1] == '\0')
-       /* "info history +" should print from the stored position.  */
-       ;
-      else
-       /* "info history <exp>" should print around value number <exp>.  */
+       /* "info history +" should print from the stored position.
+          "info history <exp>" should print around value number <exp>.  */
+      if (num_exp[0] != '+' || num_exp[1] != '\0')
        num = parse_and_eval_address (num_exp) - 5;
     }
   else
@@ -1008,7 +1006,6 @@ vb_match (type, index, basetype)
      struct type *basetype;
 {
   struct type *fieldtype;
-  struct type *fieldtype_target_type;
   char *name = TYPE_FIELD_NAME (type, index);
   char *field_class_name = NULL;