From owner-freebsd-bugs Sat Jun 23 3:10: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 978F437B401 for ; Sat, 23 Jun 2001 03:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f5NAA1Q68499; Sat, 23 Jun 2001 03:10:01 -0700 (PDT) (envelope-from gnats) Received: from ajax2.sovam.com (ajax2.sovam.com [194.67.1.173]) by hub.freebsd.org (Postfix) with ESMTP id 3B92337B407 for ; 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: TLS-CIPHER: TLS-PEER: ) by ajax2.sovam.com with ESMTP id ; 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 X-Send-Pr-Version: 3.113 Subject: bin/28362: yacc(1)-generated files fail to compile cleanly with -Wstrict-prototypes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jun 23 03:10:01 PDT 2001 >Closed-Date: >Last-Modified: >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 --- 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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message