add variable declarations in for loops for c99
This commit is contained in:
parent
5658834bef
commit
6892362adf
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.42 2009/04/14 09:10:00 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.43 2009/05/01 22:03:36 christos Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -8,6 +8,7 @@ SRCS= cgram.y scan.l mem1.c mem.c err.c main1.c decl.c tree.c func.c \
|
|||
MAN= lint.7
|
||||
YHEADER=
|
||||
#CFLAGS+=-g
|
||||
#CPPFLAGS+=-DYYDEBUG=1
|
||||
|
||||
CPPFLAGS+= -I${.CURDIR} -I. -DPASS=\"${PROG}.h\"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%{
|
||||
/* $NetBSD: cgram.y,v 1.42 2008/11/16 07:06:37 dholland Exp $ */
|
||||
/* $NetBSD: cgram.y,v 1.43 2009/05/01 22:03:36 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: cgram.y,v 1.42 2008/11/16 07:06:37 dholland Exp $");
|
||||
__RCSID("$NetBSD: cgram.y,v 1.43 2009/05/01 22:03:36 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -107,7 +107,7 @@ static inline void RESTORE(const char *file, size_t line)
|
|||
#endif
|
||||
%}
|
||||
|
||||
%expect 1
|
||||
%expect 3
|
||||
|
||||
%union {
|
||||
int y_int;
|
||||
|
@ -1462,7 +1462,13 @@ do_while_expr:
|
|||
;
|
||||
|
||||
for_exprs:
|
||||
T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN {
|
||||
T_FOR T_LPARN declspecs deftyp notype_init_decls T_SEMI opt_expr
|
||||
T_SEMI opt_expr T_RPARN {
|
||||
c99ism(325);
|
||||
for1(NULL, $7, $9);
|
||||
CLRWFLGS(__FILE__, __LINE__);
|
||||
}
|
||||
| T_FOR T_LPARN opt_expr T_SEMI opt_expr T_SEMI opt_expr T_RPARN {
|
||||
for1($3, $5, $7);
|
||||
CLRWFLGS(__FILE__, __LINE__);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $ */
|
||||
/* $NetBSD: err.c,v 1.41 2009/05/01 22:03:36 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: err.c,v 1.40 2009/04/15 01:20:57 christos Exp $");
|
||||
__RCSID("$NetBSD: err.c,v 1.41 2009/05/01 22:03:36 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -384,6 +384,7 @@ const char *msgs[] = {
|
|||
"zero sized array is a C99 extension", /* 322 */
|
||||
"continue in 'do ... while (0)' loop", /* 323 */
|
||||
"suggest cast from '%s' to '%s' on op %s to avoid overflow", /* 324 */
|
||||
"variable declaration in for loop", /* 325 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue