From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15024 invoked by alias); 6 Jan 2015 04:16:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 14917 invoked by uid 89); 6 Jan 2015 04:16:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 06 Jan 2015 04:16:22 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A83B111640F; Mon, 5 Jan 2015 23:16:20 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Iogr4B31qw+d; Mon, 5 Jan 2015 23:16:20 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 22BE5116406; Mon, 5 Jan 2015 23:16:20 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id A0B7E4100E; Tue, 6 Jan 2015 08:16:15 +0400 (RET) Date: Tue, 06 Jan 2015 04:16:00 -0000 From: Joel Brobecker To: Steve Ellcey Cc: gdb-patches@sourceware.org Subject: Re: [Patch] Fix build problem with system call in compile/compile.c Message-ID: <20150106041615.GJ5445@adacore.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-01/txt/msg00066.txt.bz2 > 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 used). -- Joel