Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 Handle c99 declarations in the middle of...



details:   https://anonhg.NetBSD.org/src/rev/2c26a681d6b3
branches:  trunk
changeset: 770125:2c26a681d6b3
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 04 16:19:59 2011 +0000

description:
Handle c99 declarations in the middle of blocks.

diffstat:

 usr.bin/xlint/lint1/cgram.y |  28 +++++++++++++++++-----------
 usr.bin/xlint/lint1/err.c   |   5 +++--
 2 files changed, 20 insertions(+), 13 deletions(-)

diffs (99 lines):

diff -r af3d161e1d7f -r 2c26a681d6b3 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Oct 04 15:27:04 2011 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Oct 04 16:19:59 2011 +0000
@@ -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 @@
 #endif
 %}
 
-%expect 3
+%expect 7
 
 %union {
        int     y_int;
@@ -1329,9 +1329,19 @@
          }
        ;
 
+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 @@
          }
        ;
 
-opt_stmnt_list:
-         /* empty */
-       | stmnt_list
-       ;
-
 stmnt_list:
          stmnt
        | stmnt_list stmnt {
@@ -1789,8 +1794,9 @@
 
 point:
          T_STROP {
-               if ($1 != POINT)
+               if ($1 != POINT) {
                        error(249, yytext);
+               }
          }
        ;
 
diff -r af3d161e1d7f -r 2c26a681d6b3 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Tue Oct 04 15:27:04 2011 +0000
+++ b/usr.bin/xlint/lint1/err.c Tue Oct 04 16:19:59 2011 +0000
@@ -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 @@
        "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 */
 };
 
 /*



Home | Main Index | Thread Index | Old Index