linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: "Justin P. Mattock" <justinmattock@gmail.com>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC]Documentation:accounting:getdelays.c Fix: warning: variable ‘i’ set but not used
Date: Mon, 11 Apr 2011 11:56:54 -0700	[thread overview]
Message-ID: <20110411115654.9ff67799.rdunlap@xenotime.net> (raw)
In-Reply-To: <1302019370-7101-1-git-send-email-justinmattock@gmail.com>

On Tue,  5 Apr 2011 09:02:50 -0700 Justin P. Mattock wrote:

> The below patch takes care of the warning, but keep in mind am unsure if this is a correct way
> to resolve this issue.
> Documentation/accounting/getdelays.c: In function ‘main’:
> Documentation/accounting/getdelays.c:436:7: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]
> 
> Keep in mind there is another warning with this file, but need am unsure what might be the best solution:
> Documentation/accounting/getdelays.c: In function ‘get_family_id’:
> Documentation/accounting/getdelays.c:172:14: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]

Hi,
Does -Wunused-but-set-variable require gcc 4.6.0?


>  Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
> 
> ---
>  Documentation/accounting/getdelays.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
> index e9c7778..16e16d5 100644
> --- a/Documentation/accounting/getdelays.c
> +++ b/Documentation/accounting/getdelays.c
> @@ -433,8 +433,6 @@ int main(int argc, char *argv[])
>  	}
>  
>  	do {
> -		int i;
> -
>  		rep_len = recv(nl_sd, &msg, sizeof(msg), 0);
>  		PRINTF("received %d bytes\n", rep_len);
>  
> @@ -459,7 +457,6 @@ int main(int argc, char *argv[])
>  
>  		na = (struct nlattr *) GENLMSG_DATA(&msg);
>  		len = 0;
> -		i = 0;
>  		while (len < rep_len) {
>  			len += NLA_ALIGN(na->nla_len);
>  			switch (na->nla_type) {
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2011-04-11 18:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 16:02 [RFC]Documentation:accounting:getdelays.c Fix: warning: variable ‘i’ set but not used Justin P. Mattock
2011-04-11 18:56 ` Randy Dunlap [this message]
2011-04-12  1:49   ` Justin P. Mattock
2011-04-13  0:26 ` Andrew Morton
2011-04-13  0:44   ` Justin P. Mattock
2011-04-13  1:18     ` Andrew Morton
2011-04-13  1:30       ` Justin P. Mattock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110411115654.9ff67799.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=justinmattock@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).