From avn@any.ru  Sat Jun 23 03:04:13 2001
Return-Path: <avn@any.ru>
Received: from ajax2.sovam.com (ajax2.sovam.com [194.67.1.173])
	by hub.freebsd.org (Postfix) with ESMTP id 3B92337B407
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 23 Jun 2001 03:04:13 -0700 (PDT)
	(envelope-from avn@any.ru)
Received: from ts9-a275.dial.sovam.com ([195.239.71.19]:1187 "EHLO srv2.any"
	ident: "TIMEDOUT" whoson: "-unregistered-" smtp-auth: <none> TLS-CIPHER:
	<none> TLS-PEER: <none>) by ajax2.sovam.com with ESMTP
	id <S424960AbRFWKEJ>; Sat, 23 Jun 2001 14:04:09 +0400
Received: (from avn@localhost)
	by srv2.any (8.11.3/8.11.3) id f5NA4GF40661;
	Sat, 23 Jun 2001 14:04:16 +0400 (MSD)
	(envelope-from avn)
Message-Id: <200106231004.f5NA4GF40661@srv2.any>
Date: Sat, 23 Jun 2001 14:04:16 +0400 (MSD)
From: avn@any.ru
Reply-To: avn@any.ru
To: FreeBSD-gnats-submit@freebsd.org
Subject: yacc(1)-generated files fail to compile cleanly with -Wstrict-prototypes
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         28362
>Category:       bin
>Synopsis:       yacc(1)-generated files fail to compile cleanly with -Wstrict-prototypes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 23 03:10:01 PDT 2001
>Closed-Date:    Wed Jul 18 22:48:48 PDT 2001
>Last-Modified:  Wed Jul 18 22:50:09 PDT 2001
>Originator:     Alexey V. Neyman
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
http://www.any.ru/
>Environment:
System: FreeBSD srv2.any 4.3-STABLE FreeBSD 4.3-STABLE #4: Thu Jun 14 12:25:16 MSD 2001 toor@srv2.any:/usr2/obj/usr2/src/sys/SRV2 i386

>Description:
.c files generated with yacc(1) fail to compile under CFLAGS=
-Wstrict-prototypes when no -ansi is specified.

>How-To-Repeat:
--- Makefile ---
CC = gcc
CFLAGS = -Wstrict-prototypes
SRCS = a.y
PROG = a
NOMAN = yes
NOOBJ = yes
.include <bsd.prog.mk>
--- a.y ---
%{
void yyerror(const char *s)
{}
int yylex(void)
{}
%}
%%
stmt    :
        ;
%%
int main(void)
{
	return 0;
}
--- end ---
this produces when compiling:
a.c:14: warning: function declaration isn't a prototype
a.c:99: warning: function declaration isn't a prototype


>Fix:
The patch below makes it happy with either '-Wstrict-prototypes' and
'-Wstrict-prototypes -ansi' and '-Wstrict-prototypes -ansi -pedantic'

--- skeleton.c.orig	Sat Jun 23 13:49:21 2001
+++ skeleton.c	Sat Jun 23 13:49:21 2001
@@ -67,7 +67,7 @@
     "#define yyclearin (yychar=(YYEMPTY))",
     "#define yyerrok (yyerrflag=0)",
     "#define YYRECOVERING() (yyerrflag!=0)",
-    "static int yygrowstack();",
+    "static int yygrowstack(void);",
     0
 };
 
@@ -127,7 +127,7 @@
 char *body[] =
 {
     "/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
-    "static int yygrowstack()",
+    "static int yygrowstack(void)",
     "{",
     "    int newsize, i;",
     "    short *newss;",
>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: avn@any.ru
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, Peter Wemm <peter@FreeBSD.ORG>
Subject: Re: bin/28362: yacc(1)-generated files fail to compile cleanly with -Wstrict-prototypes
Date: Sat, 23 Jun 2001 14:51:17 +0300

 This PR can be closed (after MFC of rev.1.29 of yacc/skeleton.c).
 
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
State-Changed-From-To: open->closed 
State-Changed-By: mike 
State-Changed-When: Wed Jul 18 22:48:48 PDT 2001 
State-Changed-Why:  

This has been fixed in -CURRENT and -STABLE. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28362 
>Unformatted:
