From c65ecaf37b02a936e0d8c4074da3b5da8017e464 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 23 Mar 2001 22:48:44 +0000 Subject: [PATCH] Fix -Werror -Wuninitialized warnings. --- gdb/ChangeLog | 10 ++++++++++ gdb/fork-child.c | 13 ++++++++++--- gdb/jv-lang.c | 4 +++- gdb/jv-valprint.c | 3 ++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e9bbddb..6cdbaa5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2001-03-23 Andrew Cagney + + * fork-child.c (fork_inferior): Make ``argv'', ``exec_file'' and + ``shell_file'' static locals. + + * jv-lang.c (java_link_class_type): Initialize ``field'' and + ``method''. + + * jv-valprint.c (java_value_print): Initialize ``next_element''. + 2001-03-23 Mark Kettenis * config/i386/nm-i386.h: Fix formatting and change reference to diff --git a/gdb/fork-child.c b/gdb/fork-child.c index e646a62..a32ab8e 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -95,10 +95,13 @@ breakup_args (char *scratch, char **argv) ENV is the environment vector to pass. SHELL_FILE is the shell file, or NULL if we should pick one. Errors reported with error(). */ +/* This function is NOT-REENTRANT. Some of the variables have been + made static to ensure that they survive the vfork() call. */ + void -fork_inferior (char *exec_file, char *allargs, char **env, +fork_inferior (char *exec_file_arg, char *allargs, char **env, void (*traceme_fun) (void), void (*init_trace_fun) (int), - void (*pre_trace_fun) (void), char *shell_file) + void (*pre_trace_fun) (void), char *shell_file_arg) { int pid; char *shell_command; @@ -109,12 +112,15 @@ fork_inferior (char *exec_file, char *allargs, char **env, /* This is set to the result of setpgrp, which if vforked, will be visible to you in the parent process. It's only used by humans for debugging. */ static int debug_setpgrp = 657473; + static char *shell_file; + static char *exec_file; char **save_our_env; int shell = 0; - char **argv; + static char **argv; /* If no exec file handed to us, get it from the exec-file command -- with a good, common error message if none is specified. */ + exec_file = exec_file_arg; if (exec_file == 0) exec_file = get_exec_file (1); @@ -122,6 +128,7 @@ fork_inferior (char *exec_file, char *allargs, char **env, * If 0, we'll just do a fork/exec, no shell, so don't * bother figuring out what shell. */ + shell_file = shell_file_arg; if (STARTUP_WITH_SHELL) { /* Figure out what shell to start up the user program under. */ diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 0fb79b4..abd0470 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -346,7 +346,9 @@ java_link_class_type (struct type *type, value_ptr clas) int type_is_object = 0; struct fn_field *fn_fields; struct fn_fieldlist *fn_fieldlists; - value_ptr fields, field, method, methods; + value_ptr fields, methods; + struct value *method = NULL; + struct value *field = NULL; int i, j; struct objfile *objfile = get_dynamics_objfile (); struct type *tsuper; diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 8ea67ce..9ba953e 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -90,7 +90,8 @@ java_value_print (value_ptr val, struct ui_file *stream, int format, if (el_type == NULL) { - CORE_ADDR element, next_element; + CORE_ADDR element; + CORE_ADDR next_element = -1; /* dummy initial value */ address += JAVA_OBJECT_SIZE + 4; /* Skip object header and length. */ -- 2.7.4