Subject: bin/3573: make(1) has inauspiciously named variable.
To: None <gnats-bugs@gnats.netbsd.org>
From: Peter Seebach <seebs@taniemarie.solon.com>
List: netbsd-bugs
Date: 05/04/1997 08:59:45
>Number:         3573
>Category:       bin
>Synopsis:       make has a variable named main.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun May  4 09:05:00 1997
>Last-Modified:
>Originator:     Peter Seebach
>Organization:
Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
Unsolicited email is not welcome, and will be billed for at consulting rates.
The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
>Release:        -current
>Environment:
System: NetBSD taniemarie 1.2D NetBSD 1.2D (SEEBS) #0: Fri Mar 28 20:24:30 CST 1997 seebs@taniemarie:/usr/src/sys/arch/amiga/compile/SEEBS amiga


>Description:
	make's parse.c has a variable named main; this triggers a warning
	from my patched gcc, indicating that main is traditionally a function.

	While the code is correct, it's arguably bad style.
>How-To-Repeat:
	Patch gcc and make make.
>Fix:
The following diff does it for me.

*** parse.orig	Sun May  4 10:55:53 1997
--- parse.c	Sun May  4 10:56:14 1997
***************
*** 2574,2591 ****
  Lst
  Parse_MainName()
  {
!     Lst           main;	/* result list */
  
!     main = Lst_Init (FALSE);
  
      if (mainNode == NILGNODE) {
  	Punt ("no target to make.");
      	/*NOTREACHED*/
      } else if (mainNode->type & OP_DOUBLEDEP) {
! 	(void) Lst_AtEnd (main, (ClientData)mainNode);
! 	Lst_Concat(main, mainNode->cohorts, LST_CONCNEW);
      }
      else
! 	(void) Lst_AtEnd (main, (ClientData)mainNode);
!     return (main);
  }
--- 2574,2591 ----
  Lst
  Parse_MainName()
  {
!     Lst           mainList;	/* result list */
  
!     mainList = Lst_Init (FALSE);
  
      if (mainNode == NILGNODE) {
  	Punt ("no target to make.");
      	/*NOTREACHED*/
      } else if (mainNode->type & OP_DOUBLEDEP) {
! 	(void) Lst_AtEnd (mainList, (ClientData)mainNode);
! 	Lst_Concat(mainList, mainNode->cohorts, LST_CONCNEW);
      }
      else
! 	(void) Lst_AtEnd (mainList, (ClientData)mainNode);
!     return (mainList);
  }
>Audit-Trail:
>Unformatted: