Source-Changes-HG archive

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

[src/trunk]: src Handle another declaration after statement case for lint in ...



details:   https://anonhg.NetBSD.org/src/rev/61c878ab2ac3
branches:  trunk
changeset: 793317:61c878ab2ac3
user:      njoly <njoly%NetBSD.org@localhost>
date:      Tue Feb 04 08:08:59 2014 +0000

description:
Handle another declaration after statement case for lint in c99 mode.
Add the corresponding testcase.

diffstat:

 distrib/sets/lists/tests/mi                         |  3 ++-
 tests/usr.bin/xlint/lint1/Makefile                  |  3 ++-
 tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c |  5 +++++
 tests/usr.bin/xlint/lint1/t_integration.sh          |  3 ++-
 usr.bin/xlint/lint1/cgram.y                         |  6 +++---
 5 files changed, 14 insertions(+), 6 deletions(-)

diffs (88 lines):

diff -r 4d255770064a -r 61c878ab2ac3 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Feb 04 01:46:38 2014 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Feb 04 08:08:59 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.561 2014/02/01 20:49:11 jmmv Exp $
+# $NetBSD: mi,v 1.562 2014/02/04 08:08:59 njoly Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3101,6 +3101,7 @@
 ./usr/tests/usr.bin/xlint/lint1/d_c99_complex_num.c            tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt.c       tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt2.c      tests-usr.bin-tests     atf
+./usr/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c      tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_for_loops.c              tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_func.c                   tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/xlint/lint1/d_c99_recursive_init.c         tests-usr.bin-tests     atf
diff -r 4d255770064a -r 61c878ab2ac3 tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Tue Feb 04 01:46:38 2014 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Tue Feb 04 08:08:59 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:15 jruoho Exp $
+# $NetBSD: Makefile,v 1.2 2014/02/04 08:08:59 njoly Exp $
 
 NOMAN=         # defined
 
@@ -13,6 +13,7 @@
 FILES+=                d_c99_complex_num.c
 FILES+=                d_c99_decls_after_stmt.c
 FILES+=                d_c99_decls_after_stmt2.c
+FILES+=                d_c99_decls_after_stmt3.c
 FILES+=                d_c99_for_loops.c
 FILES+=                d_c99_func.c
 FILES+=                d_c99_recursive_init.c
diff -r 4d255770064a -r 61c878ab2ac3 tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_decls_after_stmt3.c       Tue Feb 04 08:08:59 2014 +0000
@@ -0,0 +1,5 @@
+void sample(int i)
+{
+  i += 1;
+  int j = 0; j += 1;
+}
diff -r 4d255770064a -r 61c878ab2ac3 tests/usr.bin/xlint/lint1/t_integration.sh
--- a/tests/usr.bin/xlint/lint1/t_integration.sh        Tue Feb 04 01:46:38 2014 +0000
+++ b/tests/usr.bin/xlint/lint1/t_integration.sh        Tue Feb 04 08:08:59 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.1 2012/03/17 16:33:16 jruoho Exp $
+# $NetBSD: t_integration.sh,v 1.2 2014/02/04 08:08:59 njoly Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -82,6 +82,7 @@
     "initializers"
 test_case check_valid c9x_array_init "Checks C9X array initializers"
 test_case check_valid c99_decls_after_stmt "Checks C99 decls after statements"
+test_case check_valid c99_decls_after_stmt3 "Checks C99 decls after statements"
 test_case check_valid nolimit_init "Checks no limit initializers"
 test_case check_valid zero_sized_arrays "Checks zero sized arrays"
 
diff -r 4d255770064a -r 61c878ab2ac3 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Feb 04 01:46:38 2014 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Feb 04 08:08:59 2014 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.56 2014/01/16 00:43:43 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.57 2014/02/04 08:08:59 njoly 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.56 2014/01/16 00:43:43 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.57 2014/02/04 08:08:59 njoly Exp $");
 #endif
 
 #include <stdlib.h>
@@ -1340,7 +1340,7 @@
 
 comp_stmnt:
          comp_stmnt_lbrace comp_stmnt_rbrace
-       | comp_stmnt_lbrace stmnt_list comp_stmnt_rbrace
+       | comp_stmnt_lbrace stmnt_d_list comp_stmnt_rbrace
        | comp_stmnt_lbrace declaration_list comp_stmnt_rbrace
        | comp_stmnt_lbrace declaration_list stmnt_d_list comp_stmnt_rbrace
        ;



Home | Main Index | Thread Index | Old Index