This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

> 2015-01-05  Steve Ellcey  <>
> 	* compile/compile.c (do_rmdir): Assign return value of system call.

If we go through with a patch that eliminates the warning without
actually doing anything about it, I'd request that a comment be
added that explains why we're allowing ourselves to do so. In this
case, as Yao explains, we're in the middle of a discussion about
how to better write that code.

> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]