Re: warning when building make(1)

2017-07-10 Thread Marc Espie
On Mon, Jul 10, 2017 at 05:14:18PM +0800, Michael W. Bombardieri wrote:
> Hi,
> 
> The function build_target_group() produces two warnings when make is
> built with CDIAGFLAGS.
> 
> parse.c:1462: warning: ISO C90 forbids mixed declarations and code
> parse.c:1462: warning: 'gn2' may be used uninitialized in this function
> 
> This patch attempts to silence the warnings.
> 
> - Michael

No. The compiler is stupid.  gratuitously initializing a variable is a bad
idea.



warning when building make(1)

2017-07-10 Thread Michael W. Bombardieri
Hi,

The function build_target_group() produces two warnings when make is
built with CDIAGFLAGS.

parse.c:1462: warning: ISO C90 forbids mixed declarations and code
parse.c:1462: warning: 'gn2' may be used uninitialized in this function

This patch attempts to silence the warnings.

- Michael


Index: parse.c
===
RCS file: /cvs/src/usr.bin/make/parse.c,v
retrieving revision 1.118
diff -u -p -u -r1.118 parse.c
--- parse.c 23 Oct 2016 14:54:14 -  1.118
+++ parse.c 10 Jul 2017 09:02:35 -
@@ -1427,6 +1427,7 @@ register_target(GNode *gn, struct ohash 
 static void
 build_target_group(struct growableArray *targets, struct ohash *t)
 {
+   GNode *gn, *gn2 = NULL;
LstNode ln;
bool seen_target = false;
unsigned int i;
@@ -1459,7 +1460,6 @@ build_target_group(struct growableArray 
if (seen_target)
return;
 
-   GNode *gn, *gn2;
/* targets may already participate in groupling lists, 
 * so rebuild the circular list "from scratch"
 */