Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: GDB <gdb-patches@sources.redhat.com>
Subject: PATCH: Initialize tmp_obstack
Date: Sat, 02 Dec 2006 18:27:00 -0000	[thread overview]
Message-ID: <20061202182712.GA623@lucon.org> (raw)

Gcc 4.1 warns

cc1: warnings being treated as errors
/export/gnu/src/gdb/gdb/gdb/p-valprint.c: In function
‘pascal_object_print_value_fields’:
/export/gnu/src/gdb/gdb/gdb/p-valprint.c:756: warning:
‘tmp_obstack.alloc_failed’ may be used uninitialized in this function

This patch fixes those.

H.J.
----
2006-12-02  H.J. Lu  <hongjiu.lu@intel.com>

	* cp-valprint.c (cp_print_value_fields): Initialize tmp_obstack.
	(cp_print_value): Likewise
	* p-valprint.c (pascal_object_print_value_fields): Likewise
	(pascal_object_print_value): Likewise

--- gdb/cp-valprint.c.init	2005-12-17 14:33:59.000000000 -0800
+++ gdb/cp-valprint.c	2006-12-02 10:23:21.000000000 -0800
@@ -265,7 +265,7 @@ cp_print_value_fields (struct type *type
 		       struct type **dont_print_vb,int dont_print_statmem)
 {
   int i, len, n_baseclasses;
-  struct obstack tmp_obstack;
+  struct obstack tmp_obstack = { 0 };
   char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
   int fields_seen = 0;
 
@@ -524,7 +524,7 @@ cp_print_value (struct type *type, struc
 		struct ui_file *stream, int format, int recurse,
 		enum val_prettyprint pretty, struct type **dont_print_vb)
 {
-  struct obstack tmp_obstack;
+  struct obstack tmp_obstack = { 0 };
   struct type **last_dont_print
     = (struct type **) obstack_next_free (&dont_print_vb_obstack);
   int i, n_baseclasses = TYPE_N_BASECLASSES (type);
--- gdb/p-valprint.c.init	2006-12-02 09:50:54.000000000 -0800
+++ gdb/p-valprint.c	2006-12-02 10:22:35.000000000 -0800
@@ -753,7 +753,7 @@ pascal_object_print_value_fields (struct
 				  int dont_print_statmem)
 {
   int i, len, n_baseclasses;
-  struct obstack tmp_obstack;
+  struct obstack tmp_obstack = { 0 };
   char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
 
   CHECK_TYPEDEF (type);
@@ -922,7 +922,7 @@ pascal_object_print_value (struct type *
 			   enum val_prettyprint pretty,
 			   struct type **dont_print_vb)
 {
-  struct obstack tmp_obstack;
+  struct obstack tmp_obstack = { 0 };
   struct type **last_dont_print
   = (struct type **) obstack_next_free (&dont_print_vb_obstack);
   int i, n_baseclasses = TYPE_N_BASECLASSES (type);


             reply	other threads:[~2006-12-02 18:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-02 18:27 H. J. Lu [this message]
2006-12-05 20:40 ` Daniel Jacobowitz
2006-12-05 20:56   ` H. J. Lu
2006-12-05 21:00     ` Daniel Jacobowitz
     [not found]   ` <12601.163.1.150.229.1165354805.squirrel@webmail.xs4all.nl>
     [not found]     ` <20061205214306.GA29801@nevyn.them.org>
     [not found]       ` <20637.163.1.150.229.1165355320.squirrel@webmail.xs4all.nl>
2006-12-05 21:56         ` Daniel Jacobowitz
2006-12-05 21:59           ` Daniel Jacobowitz
2006-12-05 22:24             ` Jim Blandy
2006-12-05 23:58           ` Daniel Jacobowitz
2006-12-07 14:40             ` Daniel Jacobowitz
2006-12-25  4:00               ` Daniel Jacobowitz
2007-01-16  6:59                 ` Daniel Jacobowitz
2007-01-16 21:32                   ` Mark Kettenis
2007-01-21 13:07                   ` Mark Kettenis
2007-01-21 15:59                     ` Daniel Jacobowitz
2007-01-21 17:24                       ` Daniel Jacobowitz
2007-02-08 14:21                         ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061202182712.GA623@lucon.org \
    --to=hjl@lucon.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox