# [PATCH] sh-18n: quell "unused variable" warning

5 messages from 2011-05-25 to 2011-05-26. Participants: Michael J Gruber, Junio C Hamano, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/27452

## Michael J Gruber, 2011-05-25 09:55

Subject: [PATCH] sh-18n: quell "unused variable" warning
Message-ID: <62c2e1619edcb37c0411f29a34b6bc10e3899a97.1306317312.git.git@drmicha.warpmail.net>
URL: https://gitlist.dev/e/62c2e1619edcb37c0411f29a34b6bc10e3899a97.1306317312.git.git%40drmicha.warpmail.net

```
    CC sh-i18n--envsubst.o
sh-i18n--envsubst.c: In Funktion »main«:
sh-i18n--envsubst.c:71:22: Warnung: Variable »show_variables« gesetzt,
aber nicht verwendet [-Wunused-but-set-variable]

show_variables is indeed unused. Comment it out rather than remove it so
that the relation with upstream remains clear.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Why is it that even with LANG=C exported, gcc gives localized warnings?

And yes, I'm on gcc 4.6 now (F15)...
---
 sh-i18n--envsubst.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c
index 7125093..2eb0ee4 100644
--- a/sh-i18n--envsubst.c
+++ b/sh-i18n--envsubst.c
@@ -68,7 +68,7 @@ int
 main (int argc, char *argv[])
 {
   /* Default values for command line options.  */
-  unsigned short int show_variables = 0;
+  /* unsigned short int show_variables = 0; */
 
   switch (argc)
 	{
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
 	  /* git sh-i18n--envsubst --variables '$foo and $bar' */
 	  if (strcmp(argv[1], "--variables"))
 		error ("first argument must be --variables when two are given");
-	  show_variables = 1;
+	  /* show_variables = 1; */
       print_variables (argv[2]);
 	  break;
 	default:
-- 
1.7.5.2.639.gce8e1

```

## Junio C Hamano, 2011-05-25 16:35

Subject: Re: [PATCH] sh-18n: quell "unused variable" warning
Message-ID: <7vy61u4u1y.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vy61u4u1y.fsf%40alter.siamese.dyndns.org
In-Reply-To: <62c2e1619edcb37c0411f29a34b6bc10e3899a97.1306317312.git.git@drmicha.warpmail.net>

```
Michael J Gruber <git@drmicha.warpmail.net> writes:

>     CC sh-i18n--envsubst.o
> sh-i18n--envsubst.c: In Funktion »main«:
> sh-i18n--envsubst.c:71:22: Warnung: Variable »show_variables« gesetzt,
> aber nicht verwendet [-Wunused-but-set-variable]
>
> show_variables is indeed unused. Comment it out rather than remove it so
> that the relation with upstream remains clear.
>
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
> Why is it that even with LANG=C exported, gcc gives localized warnings?

Because you probably do not have LC_ALL=C?

In any case, thanks.

```

## Ævar Arnfjörð Bjarmason, 2011-05-25 23:33

Subject: Re: [PATCH] sh-18n: quell "unused variable" warning
Message-ID: <BANLkTi=Mgd7=eriOsz1phDBJ25Com2Y=mQ@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTi%3DMgd7%3DeriOsz1phDBJ25Com2Y%3DmQ%40mail.gmail.com
In-Reply-To: <62c2e1619edcb37c0411f29a34b6bc10e3899a97.1306317312.git.git@drmicha.warpmail.net>

```
On Wed, May 25, 2011 at 11:55, Michael J Gruber
<git@drmicha.warpmail.net> wrote:

I suppose it was inevitable that we'd end up maintaining this since
upstream only maintains the GPLv3 version now.

>   /* Default values for command line options.  */
> -  unsigned short int show_variables = 0;
> +  /* unsigned short int show_variables = 0; */

> -         show_variables = 1;
> +         /* show_variables = 1; */

Can we just remove these lines instead of commenting them out?

```

## Michael J Gruber, 2011-05-26 13:03

Subject: Re: [PATCH] sh-18n: quell "unused variable" warning
Message-ID: <4DDE4F92.7030301@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4DDE4F92.7030301%40drmicha.warpmail.net
In-Reply-To: <BANLkTi=Mgd7=eriOsz1phDBJ25Com2Y=mQ@mail.gmail.com>

```
Ævar Arnfjörð Bjarmason venit, vidit, dixit 26.05.2011 01:33:
> On Wed, May 25, 2011 at 11:55, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
> 
> I suppose it was inevitable that we'd end up maintaining this since
> upstream only maintains the GPLv3 version now.
> 
>>   /* Default values for command line options.  */
>> -  unsigned short int show_variables = 0;
>> +  /* unsigned short int show_variables = 0; */
> 
>> -         show_variables = 1;
>> +         /* show_variables = 1; */
> 
> Can we just remove these lines instead of commenting them out?

Sure, I just didn't know what is more convenient for the maintainer. I
noticed a few comments in there already but have not compared with
upstream. Resend necessary?

Michael

```

## Ævar Arnfjörð Bjarmason, 2011-05-26 13:46

Subject: Re: [PATCH] sh-18n: quell "unused variable" warning
Message-ID: <BANLkTikmNxkCyAK1C4AWYVE-mjGYxKSLmQ@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTikmNxkCyAK1C4AWYVE-mjGYxKSLmQ%40mail.gmail.com
In-Reply-To: <4DDE4F92.7030301@drmicha.warpmail.net>

```
On Thu, May 26, 2011 at 15:03, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Ævar Arnfjörð Bjarmason venit, vidit, dixit 26.05.2011 01:33:
>> On Wed, May 25, 2011 at 11:55, Michael J Gruber
>> <git@drmicha.warpmail.net> wrote:
>>
>> I suppose it was inevitable that we'd end up maintaining this since
>> upstream only maintains the GPLv3 version now.
>>
>>>   /* Default values for command line options.  */
>>> -  unsigned short int show_variables = 0;
>>> +  /* unsigned short int show_variables = 0; */
>>
>>> -         show_variables = 1;
>>> +         /* show_variables = 1; */
>>
>> Can we just remove these lines instead of commenting them out?
>
> Sure, I just didn't know what is more convenient for the maintainer. I
> noticed a few comments in there already but have not compared with
> upstream. Resend necessary?

No it's fine.

But I/we are the upstream for this program now, since GNU only
maintains the GPLv3 version.

We could just use that actually, since this is a stand-alone
program. Or do we have intrinsic objections to GPLv3 code in our
source tree?

```
