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 lint: support int[*][3] from C99



details:   https://anonhg.NetBSD.org/src/rev/a6725e76e377
branches:  trunk
changeset: 986230:a6725e76e377
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 14 19:06:27 2021 +0000

description:
lint: support int[*][3] from C99

No warning in pre-C99 mode since this declarator is not used in practice
anyway.

diffstat:

 tests/usr.bin/xlint/lint1/decl_direct_abstract.c   |   8 +++-----
 tests/usr.bin/xlint/lint1/decl_direct_abstract.exp |   6 ++----
 usr.bin/xlint/lint1/cgram.y                        |  12 ++++++++----
 3 files changed, 13 insertions(+), 13 deletions(-)

diffs (81 lines):

diff -r 189c0c9b1e45 -r a6725e76e377 tests/usr.bin/xlint/lint1/decl_direct_abstract.c
--- a/tests/usr.bin/xlint/lint1/decl_direct_abstract.c  Tue Sep 14 19:02:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_direct_abstract.c  Tue Sep 14 19:06:27 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: decl_direct_abstract.c,v 1.2 2021/09/14 19:02:15 rillig Exp $  */
+/*     $NetBSD: decl_direct_abstract.c,v 1.3 2021/09/14 19:06:27 rillig Exp $  */
 # 3 "decl_direct_abstract.c"
 
 /*
@@ -64,8 +64,7 @@
 
 void int_array(int[]);
 void int_array_3(int[3]);
-/* TODO: support this in direct_abstract_declarator */
-/* expect+1: syntax error ']' [249] */
+/* supported since cgram.y 1.362 from 2021-09-14 */
 void int_array_ast(int[*]);
 /* expect+1: error: null dimension [17] */
 void int_array_7_array(int[7][]);
@@ -75,6 +74,5 @@
 
 void int_array_array(int[][7]);
 void int_array_3_array(int[3][7]);
-/* TODO: support this in direct_abstract_declarator */
-/* expect+1: syntax error ']' [249] */
+/* supported since cgram.y 1.362 from 2021-09-14 */
 void int_array_ast_array(int[*][7]);
diff -r 189c0c9b1e45 -r a6725e76e377 tests/usr.bin/xlint/lint1/decl_direct_abstract.exp
--- a/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp        Tue Sep 14 19:02:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_direct_abstract.exp        Tue Sep 14 19:06:27 2021 +0000
@@ -8,7 +8,5 @@
 decl_direct_abstract.c(59): error: cannot initialize 'double' from 'pointer to function(void) returning void' [185]
 decl_direct_abstract.c(61): error: cannot initialize 'double' from 'pointer to function(pointer to function(void) returning int) returning void' [185]
 decl_direct_abstract.c(63): error: cannot initialize 'double' from 'pointer to function(pointer to const pointer to function(unsigned int, ...) returning int) returning void' [185]
-decl_direct_abstract.c(69): error: syntax error ']' [249]
-decl_direct_abstract.c(71): error: null dimension [17]
-decl_direct_abstract.c(74): error: null dimension [17]
-decl_direct_abstract.c(80): error: syntax error ']' [249]
+decl_direct_abstract.c(70): error: null dimension [17]
+decl_direct_abstract.c(73): error: null dimension [17]
diff -r 189c0c9b1e45 -r a6725e76e377 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Sep 14 19:02:15 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Sep 14 19:06:27 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.362 2021/09/13 06:11:51 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.363 2021/09/14 19:06:27 rillig 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.362 2021/09/13 06:11:51 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.363 2021/09/14 19:06:27 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1410,7 +1410,10 @@
        | T_LBRACK T_RBRACK {
                $$ = add_array(abstract_name(), false, 0);
          }
-       /* TODO: T_LBRACK T_ASTERISK T_RBRACK; see below */
+       | T_LBRACK T_ASTERISK T_RBRACK {
+               /* since C99 */
+               $$ = add_array(abstract_name(), false, 0);
+         }
        | T_LBRACK array_size T_RBRACK {
                $$ = add_array(abstract_name(), true,
                    to_int_constant($2, false));
@@ -1421,7 +1424,8 @@
        | direct_abstract_declarator T_LBRACK T_RBRACK {
                $$ = add_array($1, false, 0);
          }
-       | direct_abstract_declarator T_LBRACK T_ASTERISK T_RBRACK { /* C99 */
+       | direct_abstract_declarator T_LBRACK T_ASTERISK T_RBRACK {
+               /* since C99 */
                $$ = add_array($1, false, 0);
          }
        | direct_abstract_declarator T_LBRACK array_size T_RBRACK {



Home | Main Index | Thread Index | Old Index