From nobody  Mon Mar 24 06:18:16 1997
Received: (from nobody@localhost)
          by freefall.freebsd.org (8.8.5/8.8.5) id GAA09476;
          Mon, 24 Mar 1997 06:18:16 -0800 (PST)
Message-Id: <199703241418.GAA09476@freefall.freebsd.org>
Date: Mon, 24 Mar 1997 06:18:16 -0800 (PST)
From: bertram@ifib.uni-karlsruhe.de
To: freebsd-gnats-submit@freebsd.org
Subject: yacc produces output which doesn't compile with g++  [call of getenv()]
X-Send-Pr-Version: www-1.0

>Number:         3080
>Category:       bin
>Synopsis:       yacc produces output which doesn't compile with g++  [call of getenv()]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 24 06:20:01 PST 1997
>Closed-Date:    Sat Aug 23 14:50:30 MEST 1997
>Last-Modified:  Sat Aug 23 14:51:07 MEST 1997
>Originator:     Bertram Barth
>Release:        2.1.6 Release
>Organization:
private
>Environment:
>Description:
yacc-generated output holds a code sequence 

	extern char getenv();
	xxx = getenv("XXX");

which makes C++ compilers like g++ complain/fail because of 
prototype mismatch.
>How-To-Repeat:

>Fix:
yacc/skeleton.c

No good idea, since most solutions depend on previous #include statements,
like surround offending declaration with __BEGIN_DECLS/__BEGIN_DECLS

Maybe:
#if defined(__cplusplus)
extern "C" {
#endif
	extern char getenv();
#if defined(__cplusplus)
 };
#endif



>Release-Note:
>Audit-Trail:

From: hoek@freenet.hamilton.on.ca
To: bertram@ifib.uni-karlsruhe.de
Cc: freebsd-gnats-submit@FreeBSD.ORG, steve@FreeBSD.ORG
Subject: Re: bin/3080
Date: Wed, 26 Mar 1997 00:43:46 -0500 (EST)

 In Email, bertram@ifib.uni-karlsruhe.de wrote:
 > 
 > >Number:         3080
 > >Category:       bin
 > >Synopsis:       yacc produces output which doesn't compile with g++  [call of getenv()]
 > >Release:        2.1.6 Release
 > >Description:
 > yacc-generated output holds a code sequence 
 > 
 > 	extern char getenv();
 > 	xxx = getenv("XXX");
 > 
 > which makes C++ compilers like g++ complain/fail because of 
 > prototype mismatch.
 
 This should be fixed in newer versions of skeleton.c.
 
 
 > >Fix:
 > yacc/skeleton.c
 > 
 > No good idea, since most solutions depend on previous #include statements,
 > like surround offending declaration with __BEGIN_DECLS/__BEGIN_DECLS
 
 Once again, newer versions actually use a #include <stdlib.h> statement.
 They also have a #ifdef __cplusplus areoung the getenv() prototype, which
 is altogether unnecessary (the prototype, not the #ifdef, but that too, by
 implication).
 
 Have a look at bin/2792 for what I suspect is a better fix.
 
 Cc: 'd to steve@freebsd.org, too, since he's listed in the Responsible:
 field for bin/2792.
 
 
 -- 
 tIM...HOEk
 Who's been messing with my anti-paranoi shot?!
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sat Aug 23 14:50:30 MEST 1997 
State-Changed-Why:  
Basically a dup for PR #2792, which has already been closed.  See its 
audit-trail for the fix information. 
>Unformatted:
