git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] run-command.c: Fix unused variables warning with gcc 4.6

From
MSMichael Schubert <mschub@elegosoft.com>
Date
Apr 26, 2011, 13:27 UTC
Message-ID
<4DB6C83A.4040900@elegosoft.com>
In-Reply-To
<4DB6C501.6000705@drmicha.warpmail.net>
On 04/26/2011 03:13 PM, Michael J Gruber wrote:
Show 44 quoted lines
> Michael Schubert venit, vidit, dixit 26.04.2011 14:28:
>> As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Remove all
>> unused variables to prevent those warnings.
>>
>> Signed-off-by: Michael Schubert <mschub@elegosoft.com>
>> ---
>>  run-command.c |   10 ++++------
>>  1 files changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/run-command.c b/run-command.c
>> index f91e446..6e0be54 100644
>> --- a/run-command.c
>> +++ b/run-command.c
>> @@ -67,21 +67,19 @@ static int child_notifier = -1;
>>
>>  static void notify_parent(void)
>>  {
>> -	ssize_t unused;
>> -	unused = write(child_notifier, "", 1);
>> +	write(child_notifier, "", 1);
>>  }
>>
>>  static NORETURN void die_child(const char *err, va_list params)
>>  {
>>  	char msg[4096];
>> -	ssize_t unused;
>>  	int len = vsnprintf(msg, sizeof(msg), err, params);
>>  	if (len > sizeof(msg))
>>  		len = sizeof(msg);
>>
>> -	unused = write(child_err, "fatal: ", 7);
>> -	unused = write(child_err, msg, len);
>> -	unused = write(child_err, "\n", 1);
>> +	write(child_err, "fatal: ", 7);
>> +	write(child_err, msg, len);
>> +	write(child_err, "\n", 1);
>>  	exit(128);
>>  }
>>  #endif
> 
> git log -S"unused" origin/master run-command.c
> 
> shows that these dummies were introduced for a reason. How do you
> invalidate that?
Sorry, just missed that.
Previous: Michael J GruberNext: Andreas Ericsson
Message 3 of 5 in “run-command.c: Fix unused variables warning with gcc 4.6”
  1. run-command.c: Fix unused variables warning with gcc 4.6Michael Schubert, Apr 26, 2011
  2. Michael J GruberApr 26, 2011
  3. Michael SchubertApr 26, 2011
  4. Andreas EricssonApr 26, 2011
  5. Jonathan NiederApr 27, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.