diff mbox

[libbacktrace] Fix warning as error in btest.c and hence `make test`

Message ID alpine.LNX.2.00.1210040043510.1878@tuna.site
State New
Headers show

Commit Message

Gerald Pfeifer Oct. 4, 2012, 7:03 p.m. UTC
Running `make test` on my nightly testers I noticed the following
in the log files:

cc1: warnings being treated as errors
/scratch/tmp/gerald/gcc-HEAD/libbacktrace/btest.c: In function 'f23':
/scratch/tmp/gerald/gcc-HEAD/libbacktrace/btest.c:476: warning: 'expected' may be used uninitialized in this function
gmake[3]: *** [btest-btest.o] Error 1
gmake[3]: Target `btest' not remade because of errors.

Doesn't this mean that effectively the test is not executed?

In any case the patch below addresses this.  Bootstrapped and
tested on i386-unknown-freebsd10.0.

Ok?

Gerald


2012-10-04  Gerald Pfeifer  <gerald@pfeifer.com>

	* btest.c (f23): Avoid uninitialized variable warning.

Comments

Ian Lance Taylor Oct. 4, 2012, 8:07 p.m. UTC | #1
On Thu, Oct 4, 2012 at 12:03 PM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> Running `make test` on my nightly testers I noticed the following
> in the log files:
>
> cc1: warnings being treated as errors
> /scratch/tmp/gerald/gcc-HEAD/libbacktrace/btest.c: In function 'f23':
> /scratch/tmp/gerald/gcc-HEAD/libbacktrace/btest.c:476: warning: 'expected' may be used uninitialized in this function
> gmake[3]: *** [btest-btest.o] Error 1
> gmake[3]: Target `btest' not remade because of errors.
>
> Doesn't this mean that effectively the test is not executed?

I don't think so, not sure what you are getting at here.  I'm not sure
why I even wrote "case 3:", j can never take on the value 3.

> 2012-10-04  Gerald Pfeifer  <gerald@pfeifer.com>
>
>         * btest.c (f23): Avoid uninitialized variable warning.

This is OK.

Thanks.

Ian
Gerald Pfeifer Oct. 4, 2012, 9:46 p.m. UTC | #2
On Thu, 4 Oct 2012, Ian Lance Taylor wrote:
>> cc1: warnings being treated as errors
>> /scratch/tmp/gerald/gcc-HEAD/libbacktrace/btest.c: In function 'f23':
>> /scratch/tmp/gerald/gcc-HEAD/libbacktrace/btest.c:476: warning: 'expected' may be used uninitialized in this function
>> gmake[3]: *** [btest-btest.o] Error 1
>> gmake[3]: Target `btest' not remade because of errors.
>>
>> Doesn't this mean that effectively the test is not executed?
> I don't think so, not sure what you are getting at here.  

With "warnings being treated as error" the warning lead to
"btest-btest.o] Error 1" and so I thought the build did not
actually go through.

Anyway, after my patch this is now gone. :-)  Thanks for the
quick review!

Gerald
diff mbox

Patch

Index: btest.c
===================================================================
--- btest.c	(revision 192086)
+++ btest.c	(working copy)
@@ -486,7 +486,7 @@ 
 		case 2:
 		  expected = "test3";
 		  break;
-		case 3:
+		default:
 		  assert (0);
 		}