Module Name: src
Committed By: christos
Date: Tue Oct 4 16:19:59 UTC 2011
Modified Files:
src/usr.bin/xlint/lint1: cgram.y err.c
Log Message:
Handle c99 declarations in the middle of blocks.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/lint1/err.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.49 src/usr.bin/xlint/lint1/cgram.y:1.50
--- src/usr.bin/xlint/lint1/cgram.y:1.49 Tue Feb 9 18:05:16 2010
+++ src/usr.bin/xlint/lint1/cgram.y Tue Oct 4 12:19:59 2011
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.49 2010/02/09 23:05:16 wiz Exp $ */
+/* $NetBSD: cgram.y,v 1.50 2011/10/04 16:19:59 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.49 2010/02/09 23:05:16 wiz Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.50 2011/10/04 16:19:59 christos Exp $");
#endif
#include <stdlib.h>
@@ -107,7 +107,7 @@ static inline void RESTORE(const char *f
#endif
%}
-%expect 3
+%expect 7
%union {
int y_int;
@@ -1329,9 +1329,19 @@ label:
}
;
+stmnt_d_list:
+ stmnt_list
+ | stmnt_d_list declaration_list stmnt_list {
+ if (!Sflag)
+ c99ism(327);
+ }
+ ;
+
comp_stmnt:
- comp_stmnt_lbrace declaration_list opt_stmnt_list comp_stmnt_rbrace
- | comp_stmnt_lbrace opt_stmnt_list comp_stmnt_rbrace
+ comp_stmnt_lbrace comp_stmnt_rbrace
+ | comp_stmnt_lbrace stmnt_list comp_stmnt_rbrace
+ | comp_stmnt_lbrace declaration_list comp_stmnt_rbrace
+ | comp_stmnt_lbrace declaration_list stmnt_d_list comp_stmnt_rbrace
;
comp_stmnt_lbrace:
@@ -1352,11 +1362,6 @@ comp_stmnt_rbrace:
}
;
-opt_stmnt_list:
- /* empty */
- | stmnt_list
- ;
-
stmnt_list:
stmnt
| stmnt_list stmnt {
@@ -1789,8 +1794,9 @@ point_or_arrow:
point:
T_STROP {
- if ($1 != POINT)
+ if ($1 != POINT) {
error(249, yytext);
+ }
}
;
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.43 src/usr.bin/xlint/lint1/err.c:1.44
--- src/usr.bin/xlint/lint1/err.c:1.43 Fri Oct 2 11:03:45 2009
+++ src/usr.bin/xlint/lint1/err.c Tue Oct 4 12:19:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.43 2009/10/02 15:03:45 christos Exp $ */
+/* $NetBSD: err.c,v 1.44 2011/10/04 16:19:59 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.43 2009/10/02 15:03:45 christos Exp $");
+__RCSID("$NetBSD: err.c,v 1.44 2011/10/04 16:19:59 christos Exp $");
#endif
#include <sys/types.h>
@@ -386,6 +386,7 @@ const char *msgs[] = {
"suggest cast from '%s' to '%s' on op %s to avoid overflow", /* 324 */
"variable declaration in for loop", /* 325 */
"%s attribute ignored for %s", /* 326 */
+ "declarations after statements is a C9X feature", /* 327 */
};
/*