Re: [Patch] Fix build problem with system call in compile/compile.c

Steve Ellcey
2015-01-06T16:04:22Z

On Tue, 2015-01-06 at 08:16 +0400, Joel Brobecker wrote:

> > diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
> > index 1d18bd7..f9f03f1 100644
> > --- a/gdb/compile/compile.c
> > +++ b/gdb/compile/compile.c
> > @@ -169,10 +169,12 @@ do_rmdir (void *arg)
> > {
> > const char *dir = arg;
> > char *zap;
> > + int i;
> >
> > gdb_assert (strncmp (dir, TMP_PREFIX, strlen (TMP_PREFIX)) == 0);
> > zap = concat ("rm -rf ", dir, (char *) NULL);
> > - system (zap);
> > + /* GCC may generate warning if we ignore the return value of system call. */
> > + i = system (zap);
> > }
> >
> > /* Return the name of the temporary directory to use for .o files, and
>
> Does it work to cast the result of the call to system to (void)
> instead? In your case, I fear that you'd be exchanging one warning
> (return value being ignored) by another (value assigned but never
> used).

No, I tried using "(void) system (zap);" instead of "i = system (zap);"
and I still got the warning message.

I am going to respond on the "GDB 7.9 branching" email thread that I
think this bug is a blocking bug since it breaks the build on some
machines. I certainly think it needs to be addressed somehow before we
release the next GDB.

Steve Ellcey
sellcey@imgtec.com