* Fix non-pointer-sign gcc warnings
@ 2006-01-15 20:28 Daniel Jacobowitz
2006-01-16 7:04 ` Jim Blandy
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-01-15 20:28 UTC (permalink / raw)
To: gdb-patches
Prompted by Mark's suggestion, this is the only remaining GCC4 warnings
after -Wno-pointer-sign. GCC4 is much more aggressive about inlining
static functions, especially when only used once. It then does
uninitialized variable warnings across variables passed by address to
inlined functions. It also can do uninitialized warnings for members
of structures.
The one in macroexp.c is not a real bug but I think GCC is justified in
not being able to see through it. The one in stabsread.c is a real bug
and would cause GDB to crash on bad stabs.
--
Daniel Jacobowitz
CodeSourcery
2006-01-15 Daniel Jacobowitz <dan@codesourcery.com>
* macroexp.c (expand): Initialize argc.
* stabsread.c (read_type): Handle errors from read_args.
(read_args): Return NULL for errors.
Index: macroexp.c
===================================================================
RCS file: /cvs/src/src/gdb/macroexp.c,v
retrieving revision 1.8
diff -u -p -r1.8 macroexp.c
--- macroexp.c 17 Dec 2005 22:34:01 -0000 1.8
+++ macroexp.c 15 Jan 2006 20:23:21 -0000
@@ -927,7 +927,7 @@ expand (const char *id,
else if (def->kind == macro_function_like)
{
struct cleanup *back_to = make_cleanup (null_cleanup, 0);
- int argc;
+ int argc = 0;
struct macro_buffer *argv = NULL;
struct macro_buffer substituted;
struct macro_buffer substituted_src;
Index: stabsread.c
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.c,v
retrieving revision 1.82
diff -u -p -r1.82 stabsread.c
--- stabsread.c 17 Dec 2005 22:34:02 -0000 1.82
+++ stabsread.c 15 Jan 2006 20:23:22 -0000
@@ -1804,6 +1804,8 @@ again:
return_type = read_type (pp, objfile);
args = read_args (pp, ';', objfile, &nargs, &varargs);
+ if (args == NULL)
+ return error_type (pp, objfile);
type = dbx_alloc_type (typenums, objfile);
smash_to_method_type (type, domain, return_type, args,
nargs, varargs);
@@ -3985,8 +3987,8 @@ handle_true_range:
}
/* Read in an argument list. This is a list of types, separated by commas
- and terminated with END. Return the list of types read in, or (struct type
- **)-1 if there is an error. */
+ and terminated with END. Return the list of types read in, or NULL
+ if there is an error. */
static struct field *
read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
@@ -4001,7 +4003,7 @@ read_args (char **pp, int end, struct ob
{
if (**pp != ',')
/* Invalid argument list: no ','. */
- return (struct field *) -1;
+ return NULL;
(*pp)++;
STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Fix non-pointer-sign gcc warnings
2006-01-15 20:28 Fix non-pointer-sign gcc warnings Daniel Jacobowitz
@ 2006-01-16 7:04 ` Jim Blandy
2006-01-16 13:42 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Jim Blandy @ 2006-01-16 7:04 UTC (permalink / raw)
To: gdb-patches
On 1/15/06, Daniel Jacobowitz <drow@false.org> wrote:
> The one in macroexp.c is not a real bug but I think GCC is justified in
> not being able to see through it. The one in stabsread.c is a real bug
> and would cause GDB to crash on bad stabs.
Would it make more sense to have gather_arguments actually always
assign something to *ARGC_P? This would treat *ARGC_P as more like
part of the return value, which is how I see it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix non-pointer-sign gcc warnings
2006-01-16 7:04 ` Jim Blandy
@ 2006-01-16 13:42 ` Daniel Jacobowitz
2006-01-16 22:22 ` Jim Blandy
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-01-16 13:42 UTC (permalink / raw)
To: gdb-patches
On Sun, Jan 15, 2006 at 11:04:42PM -0800, Jim Blandy wrote:
> On 1/15/06, Daniel Jacobowitz <drow@false.org> wrote:
> > The one in macroexp.c is not a real bug but I think GCC is justified in
> > not being able to see through it. The one in stabsread.c is a real bug
> > and would cause GDB to crash on bad stabs.
>
> Would it make more sense to have gather_arguments actually always
> assign something to *ARGC_P? This would treat *ARGC_P as more like
> part of the return value, which is how I see it.
I don't know; the "leave reference arguments alone on error" behavior
is a pretty common convention in C, and somebody went to the trouble of
documenting it above the function - looks like it was you :-)
Either way makes sense.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix non-pointer-sign gcc warnings
2006-01-16 13:42 ` Daniel Jacobowitz
@ 2006-01-16 22:22 ` Jim Blandy
0 siblings, 0 replies; 4+ messages in thread
From: Jim Blandy @ 2006-01-16 22:22 UTC (permalink / raw)
To: gdb-patches
On 1/16/06, Daniel Jacobowitz <drow@false.org> wrote:
> I don't know; the "leave reference arguments alone on error" behavior
> is a pretty common convention in C, and somebody went to the trouble of
> documenting it above the function - looks like it was you :-)
You're right, it is a common convention, and I did write that...
Never mind, then. :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-01-16 22:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-15 20:28 Fix non-pointer-sign gcc warnings Daniel Jacobowitz
2006-01-16 7:04 ` Jim Blandy
2006-01-16 13:42 ` Daniel Jacobowitz
2006-01-16 22:22 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox