Module Name:    src
Committed By:   rillig
Date:           Mon Jun 28 11:09:35 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: fix parse error for type 'void (*)[*]'


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_155.c \
    src/tests/usr.bin/xlint/lint1/msg_155.exp
cvs rdiff -u -r1.246 -r1.247 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_155.c
diff -u src/tests/usr.bin/xlint/lint1/msg_155.c:1.5 src/tests/usr.bin/xlint/lint1/msg_155.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_155.c:1.5	Mon Jun 28 10:29:05 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.c	Mon Jun 28 11:09:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_155.c,v 1.5 2021/06/28 10:29:05 rillig Exp $	*/
+/*	$NetBSD: msg_155.c,v 1.6 2021/06/28 11:09:35 rillig Exp $	*/
 # 3 "msg_155.c"
 
 // Test for message: passing '%s' to incompatible '%s', arg #%d [155]
@@ -8,7 +8,7 @@ void c99_6_7_6_example_a(int);
 void c99_6_7_6_example_b(int *);
 void c99_6_7_6_example_c(int *[3]);
 void c99_6_7_6_example_d(int (*)[3]);
-void c99_6_7_6_example_e(int (*)[*]);	/* expect: syntax error ']' *//* FIXME */
+void c99_6_7_6_example_e(int (*)[*]);
 // FIXME: assertion "sym->s_type != NULL" failed in declare_argument at decl.c:2436
 // void c99_6_7_6_example_f(int *());
 void c99_6_7_6_example_g(int (*)(void));
@@ -34,8 +34,7 @@ provoke_error_messages(struct incompatib
 	/* expect+1: 'pointer to array[3] of int' */
 	c99_6_7_6_example_d(arg);
 
-	/* TODO: C99 says 'pointer to a variable length array of an unspecified number of ints' */
-	/* FIXME: no warning or error at all for an undefined function? */
+	/* expect+1: 'pointer to array[unknown_size] of int' */
 	c99_6_7_6_example_e(arg);
 
 	/* TODO: C99 says 'function with no parameter specification returning a pointer to int' */
Index: src/tests/usr.bin/xlint/lint1/msg_155.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.6
--- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.5	Mon Jun 28 10:29:05 2021
+++ src/tests/usr.bin/xlint/lint1/msg_155.exp	Mon Jun 28 11:09:35 2021
@@ -1,7 +1,7 @@
-msg_155.c(11): error: syntax error ']' [249]
 msg_155.c(25): warning: passing 'struct incompatible' to incompatible 'int', arg #1 [155]
 msg_155.c(28): warning: passing 'struct incompatible' to incompatible 'pointer to int', arg #1 [155]
 msg_155.c(32): warning: passing 'struct incompatible' to incompatible 'pointer to pointer to int', arg #1 [155]
 msg_155.c(35): warning: passing 'struct incompatible' to incompatible 'pointer to array[3] of int', arg #1 [155]
-msg_155.c(46): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
-msg_155.c(49): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]
+msg_155.c(38): warning: passing 'struct incompatible' to incompatible 'pointer to array[unknown_size] of int', arg #1 [155]
+msg_155.c(45): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155]
+msg_155.c(48): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155]

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.246 src/usr.bin/xlint/lint1/cgram.y:1.247
--- src/usr.bin/xlint/lint1/cgram.y:1.246	Mon Jun 28 09:40:52 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jun 28 11:09:35 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.246 2021/06/28 09:40:52 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.247 2021/06/28 11:09:35 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.246 2021/06/28 09:40:52 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.247 2021/06/28 11:09:35 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1462,7 +1462,7 @@ abstract_declarator:		/* C99 6.7.6 */
 	  }
 	;
 
-direct_abstract_declarator:
+direct_abstract_declarator:		/* C99 6.7.6 */
 	  T_LPAREN abstract_declarator T_RPAREN {
 		$$ = $2;
 	  }
@@ -1478,6 +1478,9 @@ direct_abstract_declarator:
 	| direct_abstract_declarator T_LBRACK T_RBRACK {
 		$$ = add_array($1, false, 0);
 	  }
+	| direct_abstract_declarator T_LBRACK T_ASTERISK T_RBRACK { /* C99 */
+		$$ = add_array($1, false, 0);
+	  }
 	| direct_abstract_declarator T_LBRACK array_size T_RBRACK {
 		$$ = add_array($1, true, to_int_constant($3, false));
 	  }

Reply via email to