Date: Sat, 23 Jun 2001 14:04:16 +0400 (MSD) From: avn@any.ru To: FreeBSD-gnats-submit@freebsd.org Subject: bin/28362: yacc(1)-generated files fail to compile cleanly with -Wstrict-prototypes Message-ID: <200106231004.f5NA4GF40661@srv2.any>
next in thread | raw e-mail | index | archive | help
>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 <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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106231004.f5NA4GF40661>