CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Jun 29 05:41:45 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove comment from grammar rule type_direct_decl The 'identifier' in type_direct_decl is necessary, as demonstrated in the test d_typename_as_var. Replacing T_NAME with 'identifier' in notype_direct_decl would increase the shift/reduce conflicts by 6. To keep this number low, keep everything as-is. To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 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.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Tue Jun 29 05:41:45 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove comment from grammar rule type_direct_decl The 'identifier' in type_direct_decl is necessary, as demonstrated in the test d_typename_as_var. Replacing T_NAME with 'identifier' in notype_direct_decl would increase the shift/reduce conflicts by 6. To keep this number low, keep everything as-is. To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 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/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.247 src/usr.bin/xlint/lint1/cgram.y:1.248 --- src/usr.bin/xlint/lint1/cgram.y:1.247 Mon Jun 28 11:09:35 2021 +++ src/usr.bin/xlint/lint1/cgram.y Tue Jun 29 05:41:45 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.247 2021/06/28 11:09:35 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.248 2021/06/29 05:41:45 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.247 2021/06/28 11:09:35 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.248 2021/06/29 05:41:45 rillig Exp $"); #endif #include @@ -1091,10 +1091,6 @@ notype_direct_decl: | notype_direct_decl type_attribute_list ; -/* - * TODO: document whether the subtle difference between 'identifier' here and - * 'T_NAME' in notype_direct_decl above is on purpose. - */ type_direct_decl: identifier { $$ = declarator_name(getsym($1));
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Tue Jun 29 00:35:23 UTC 2021 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: Allow BROKEN_TESTS to cause TESTS to be skipped. Some tests simply do not work in some environments. Eg. shell-ksh on macos/arm64 Allow local site to set BROKEN_TESTS to skip those they know will not work. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 src/usr.bin/make/unit-tests/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Tue Jun 29 00:35:23 UTC 2021 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: Allow BROKEN_TESTS to cause TESTS to be skipped. Some tests simply do not work in some environments. Eg. shell-ksh on macos/arm64 Allow local site to set BROKEN_TESTS to skip those they know will not work. Reviewed by: rillig To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 src/usr.bin/make/unit-tests/Makefile 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/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.279 src/usr.bin/make/unit-tests/Makefile:1.280 --- src/usr.bin/make/unit-tests/Makefile:1.279 Wed Jun 16 09:39:48 2021 +++ src/usr.bin/make/unit-tests/Makefile Tue Jun 29 00:35:23 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.279 2021/06/16 09:39:48 rillig Exp $ +# $NetBSD: Makefile,v 1.280 2021/06/29 00:35:23 sjg Exp $ # # Unit tests for make(1) # @@ -429,6 +429,12 @@ TESTS+= varparse-mod TESTS+= varparse-undef-partial TESTS+= varquote +# Some tests just do not work on some platforms or environments +# so allow for some filtering. +.if !empty(BROKEN_TESTS) +TESTS:= ${TESTS:${BROKEN_TESTS:S,^,N,:ts:}} +.endif + # Ideas for more tests: # char-0020-space.mk # char-005C-backslash.mk
CVS commit: src/sys
Module Name:src Committed By: chs Date: Mon Jun 28 17:52:13 UTC 2021 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c src/sys/miscfs/fdesc: fdesc_vnops.c src/sys/miscfs/kernfs: kernfs_vnops.c src/sys/miscfs/procfs: procfs_vnops.c Log Message: VOP_BMAP() may be called via ioctl(FIOGETBMAP) on any vnode that applications can open. change various pseudo-fs *_bmap methods return an error instead of panic. Reported-by: syzbot+8289a3eaf2ba60958...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/fs/ptyfs/ptyfs_vnops.c cvs rdiff -u -r1.135 -r1.136 src/sys/miscfs/fdesc/fdesc_vnops.c cvs rdiff -u -r1.166 -r1.167 src/sys/miscfs/kernfs/kernfs_vnops.c cvs rdiff -u -r1.215 -r1.216 src/sys/miscfs/procfs/procfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/ptyfs/ptyfs_vnops.c diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.62 src/sys/fs/ptyfs/ptyfs_vnops.c:1.63 --- src/sys/fs/ptyfs/ptyfs_vnops.c:1.62 Fri Nov 27 14:43:57 2020 +++ src/sys/fs/ptyfs/ptyfs_vnops.c Mon Jun 28 17:52:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs_vnops.c,v 1.62 2020/11/27 14:43:57 christos Exp $ */ +/* $NetBSD: ptyfs_vnops.c,v 1.63 2021/06/28 17:52:12 chs Exp $ */ /* * Copyright (c) 1993, 1995 @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.62 2020/11/27 14:43:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.63 2021/06/28 17:52:12 chs Exp $"); #include #include @@ -144,7 +144,7 @@ int ptyfs_reclaim (void *); int ptyfs_inactive (void *); #define ptyfs_lock genfs_lock #define ptyfs_unlock genfs_unlock -#define ptyfs_bmap genfs_badop +#define ptyfs_bmap genfs_eopnotsupp #define ptyfs_strategy genfs_badop int ptyfs_print (void *); int ptyfs_pathconf (void *); Index: src/sys/miscfs/fdesc/fdesc_vnops.c diff -u src/sys/miscfs/fdesc/fdesc_vnops.c:1.135 src/sys/miscfs/fdesc/fdesc_vnops.c:1.136 --- src/sys/miscfs/fdesc/fdesc_vnops.c:1.135 Sat May 1 15:08:14 2021 +++ src/sys/miscfs/fdesc/fdesc_vnops.c Mon Jun 28 17:52:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdesc_vnops.c,v 1.135 2021/05/01 15:08:14 hannken Exp $ */ +/* $NetBSD: fdesc_vnops.c,v 1.136 2021/06/28 17:52:13 chs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.135 2021/05/01 15:08:14 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.136 2021/06/28 17:52:13 chs Exp $"); #include #include @@ -104,7 +104,7 @@ int fdesc_inactive(void *); int fdesc_reclaim(void *); #define fdesc_lock genfs_lock #define fdesc_unlock genfs_unlock -#define fdesc_bmap genfs_badop +#define fdesc_bmap genfs_eopnotsupp #define fdesc_strategy genfs_badop int fdesc_print(void *); int fdesc_pathconf(void *); Index: src/sys/miscfs/kernfs/kernfs_vnops.c diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.166 src/sys/miscfs/kernfs/kernfs_vnops.c:1.167 --- src/sys/miscfs/kernfs/kernfs_vnops.c:1.166 Sat Jun 27 17:29:19 2020 +++ src/sys/miscfs/kernfs/kernfs_vnops.c Mon Jun 28 17:52:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kernfs_vnops.c,v 1.166 2020/06/27 17:29:19 christos Exp $ */ +/* $NetBSD: kernfs_vnops.c,v 1.167 2021/06/28 17:52:13 chs Exp $ */ /* * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.166 2020/06/27 17:29:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.167 2021/06/28 17:52:13 chs Exp $"); #include #include @@ -166,7 +166,7 @@ int kernfs_reclaim(void *); #define kernfs_lock genfs_lock #define kernfs_unlock genfs_unlock #define kernfs_bmap genfs_badop -#define kernfs_strategy genfs_badop +#define kernfs_strategy genfs_eopnotsupp int kernfs_print(void *); #define kernfs_islocked genfs_islocked int kernfs_pathconf(void *); Index: src/sys/miscfs/procfs/procfs_vnops.c diff -u src/sys/miscfs/procfs/procfs_vnops.c:1.215 src/sys/miscfs/procfs/procfs_vnops.c:1.216 --- src/sys/miscfs/procfs/procfs_vnops.c:1.215 Sat Jun 27 17:29:19 2020 +++ src/sys/miscfs/procfs/procfs_vnops.c Mon Jun 28 17:52:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vnops.c,v 1.215 2020/06/27 17:29:19 christos Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.216 2021/06/28 17:52:13 chs Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.215 2020/06/27 17:29:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.216 2021/06/28 17:52:13 chs Exp $"); #include #include @@ -237,7 +237,7 @@ int procfs_inactive(void *); int procfs_reclaim(void *); #define procfs_lock genfs_lock #define procfs_unlock genfs_unlock -#define procfs_bmap genfs_badop +#define procfs_bmap genfs_eopnotsupp #define procfs_strategy genfs_badop int procfs_print(void *); int procfs_pathconf(void *);
CVS commit: src/sys
Module Name:src Committed By: chs Date: Mon Jun 28 17:52:13 UTC 2021 Modified Files: src/sys/fs/ptyfs: ptyfs_vnops.c src/sys/miscfs/fdesc: fdesc_vnops.c src/sys/miscfs/kernfs: kernfs_vnops.c src/sys/miscfs/procfs: procfs_vnops.c Log Message: VOP_BMAP() may be called via ioctl(FIOGETBMAP) on any vnode that applications can open. change various pseudo-fs *_bmap methods return an error instead of panic. Reported-by: syzbot+8289a3eaf2ba60958...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/fs/ptyfs/ptyfs_vnops.c cvs rdiff -u -r1.135 -r1.136 src/sys/miscfs/fdesc/fdesc_vnops.c cvs rdiff -u -r1.166 -r1.167 src/sys/miscfs/kernfs/kernfs_vnops.c cvs rdiff -u -r1.215 -r1.216 src/sys/miscfs/procfs/procfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 11:27:00 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp msg_215.c msg_215.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: in C99 mode, complain about implicitly declared functions C99, foreword, p5, item 22 lists among the major changes from C90: "remove implicit function declaration". To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_215.c \ src/tests/usr.bin/xlint/lint1/msg_215.exp cvs rdiff -u -r1.293 -r1.294 src/usr.bin/xlint/lint1/tree.c 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.6 src/tests/usr.bin/xlint/lint1/msg_155.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_155.c:1.6 Mon Jun 28 11:09:35 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.c Mon Jun 28 11:27:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_155.c,v 1.6 2021/06/28 11:09:35 rillig Exp $ */ +/* $NetBSD: msg_155.c,v 1.7 2021/06/28 11:27:00 rillig Exp $ */ # 3 "msg_155.c" // Test for message: passing '%s' to incompatible '%s', arg #%d [155] @@ -38,8 +38,7 @@ provoke_error_messages(struct incompatib c99_6_7_6_example_e(arg); /* TODO: C99 says 'function with no parameter specification returning a pointer to int' */ - /* FIXME: no warning or error at all for an undefined function? */ - c99_6_7_6_example_f(arg); + c99_6_7_6_example_f(arg); /* expect: function implicitly declared */ /* expect+1: 'pointer to function(void) returning int' */ c99_6_7_6_example_g(arg); Index: src/tests/usr.bin/xlint/lint1/msg_155.exp diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.7 --- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.6 Mon Jun 28 11:09:35 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.exp Mon Jun 28 11:27:00 2021 @@ -3,5 +3,6 @@ msg_155.c(28): warning: passing 'struct 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(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] +msg_155.c(41): error: function implicitly declared to return int [215] +msg_155.c(44): warning: passing 'struct incompatible' to incompatible 'pointer to function(void) returning int', arg #1 [155] +msg_155.c(47): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning int', arg #1 [155] Index: src/tests/usr.bin/xlint/lint1/msg_215.c diff -u src/tests/usr.bin/xlint/lint1/msg_215.c:1.2 src/tests/usr.bin/xlint/lint1/msg_215.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_215.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_215.c Mon Jun 28 11:27:00 2021 @@ -1,7 +1,10 @@ -/* $NetBSD: msg_215.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_215.c,v 1.3 2021/06/28 11:27:00 rillig Exp $ */ # 3 "msg_215.c" // Test for message: function implicitly declared to return int [215] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +void +caller(void) +{ + callee(12345); /* expect: [215] */ +} Index: src/tests/usr.bin/xlint/lint1/msg_215.exp diff -u src/tests/usr.bin/xlint/lint1/msg_215.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_215.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_215.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_215.exp Mon Jun 28 11:27:00 2021 @@ -1 +1 @@ -msg_215.c(6): error: syntax error ':' [249] +msg_215.c(9): error: function implicitly declared to return int [215] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.293 src/usr.bin/xlint/lint1/tree.c:1.294 --- src/usr.bin/xlint/lint1/tree.c:1.293 Mon Jun 28 10:23:49 2021 +++ src/usr.bin/xlint/lint1/tree.c Mon Jun 28 11:27:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.293 2021/06/28 10:23:49 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.294 2021/06/28 11:27:00 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.293 2021/06/28 10:23:49 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.294 2021/06/28 11:27:00 rillig Exp $"); #endif
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 11:27:00 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp msg_215.c msg_215.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: in C99 mode, complain about implicitly declared functions C99, foreword, p5, item 22 lists among the major changes from C90: "remove implicit function declaration". To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_215.c \ src/tests/usr.bin/xlint/lint1/msg_215.exp cvs rdiff -u -r1.293 -r1.294 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
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 #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 @@ -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)); }
CVS commit: src
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.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 10:29:05 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp src/usr.bin/xlint/common: tyname.c Log Message: lint: fix type name for prototype function without parameters To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/tyname.c 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.4 src/tests/usr.bin/xlint/lint1/msg_155.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_155.c:1.4 Mon Jun 28 10:23:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.c Mon Jun 28 10:29:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_155.c,v 1.4 2021/06/28 10:23:50 rillig Exp $ */ +/* $NetBSD: msg_155.c,v 1.5 2021/06/28 10:29:05 rillig Exp $ */ # 3 "msg_155.c" // Test for message: passing '%s' to incompatible '%s', arg #%d [155] @@ -42,8 +42,7 @@ provoke_error_messages(struct incompatib /* FIXME: no warning or error at all for an undefined function? */ c99_6_7_6_example_f(arg); - /* TODO: fix type_name to generate '(void)' in this case */ - /* expect+1: 'pointer to function() returning int' */ + /* expect+1: 'pointer to function(void) returning int' */ c99_6_7_6_example_g(arg); /* expect+1: 'pointer to const pointer to function(unsigned int, ...) returning int' */ Index: src/tests/usr.bin/xlint/lint1/msg_155.exp diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.4 Mon Jun 28 10:23:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.exp Mon Jun 28 10:29:05 2021 @@ -3,5 +3,5 @@ msg_155.c(25): warning: passing 'struct 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(47): warning: passing 'struct incompatible' to incompatible 'pointer to function() returning int', arg #1 [155] -msg_155.c(50): warning: passing 'struct incompatible' to incompatible 'pointer to const pointer to function(unsigned int, ...) returning 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] Index: src/usr.bin/xlint/common/tyname.c diff -u src/usr.bin/xlint/common/tyname.c:1.41 src/usr.bin/xlint/common/tyname.c:1.42 --- src/usr.bin/xlint/common/tyname.c:1.41 Fri Jun 4 20:54:18 2021 +++ src/usr.bin/xlint/common/tyname.c Mon Jun 28 10:29:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tyname.c,v 1.41 2021/06/04 20:54:18 rillig Exp $ */ +/* $NetBSD: tyname.c,v 1.42 2021/06/28 10:29:05 rillig Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tyname.c,v 1.41 2021/06/04 20:54:18 rillig Exp $"); +__RCSID("$NetBSD: tyname.c,v 1.42 2021/06/28 10:29:05 rillig Exp $"); #endif #include @@ -263,14 +263,20 @@ type_name_of_function(buffer *buf, const #ifdef t_enum /* lint1 */ sym_t *arg; - for (arg = tp->t_args; arg != NULL; arg = arg->s_next) { + arg = tp->t_args; + if (arg == NULL) + buf_add(buf, "void"); + for (; arg != NULL; arg = arg->s_next) { buf_add(buf, sep), sep = ", "; buf_add(buf, type_name(arg->s_type)); } #else /* lint2 */ type_t **argtype; - for (argtype = tp->t_args; *argtype != NULL; argtype++) { + argtype = tp->t_args; + if (argtype == NULL) + buf_add(buf, "void"); + for (; *argtype != NULL; argtype++) { buf_add(buf, sep), sep = ", "; buf_add(buf, type_name(*argtype)); }
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 10:29:05 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp src/usr.bin/xlint/common: tyname.c Log Message: lint: fix type name for prototype function without parameters To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/common/tyname.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 10:23:50 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add type information to message 155 (type mismatch) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.292 -r1.293 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 10:23:50 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add type information to message 155 (type mismatch) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.292 -r1.293 src/usr.bin/xlint/lint1/tree.c 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.3 src/tests/usr.bin/xlint/lint1/msg_155.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_155.c:1.3 Mon Jun 28 10:07:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.c Mon Jun 28 10:23:50 2021 @@ -1,8 +1,8 @@ -/* $NetBSD: msg_155.c,v 1.3 2021/06/28 10:07:43 rillig Exp $ */ +/* $NetBSD: msg_155.c,v 1.4 2021/06/28 10:23:50 rillig Exp $ */ # 3 "msg_155.c" -// Test for message: argument is incompatible with prototype, arg #%d [155] -// TODO: Add type information to the message +// Test for message: passing '%s' to incompatible '%s', arg #%d [155] + void c99_6_7_6_example_a(int); void c99_6_7_6_example_b(int *); @@ -21,27 +21,31 @@ struct incompatible { void provoke_error_messages(struct incompatible arg) { - /* expect+1: argument is incompatible with prototype, arg #1 */ + /* expect+1: 'int' */ c99_6_7_6_example_a(arg); - /* expect+1: argument is incompatible with prototype, arg #1 */ + /* expect+1: 'pointer to int' */ c99_6_7_6_example_b(arg); - /* expect+1: argument is incompatible with prototype, arg #1 */ + /* C99 says 'array[3] of pointer to int', which is close enough. */ + /* expect+1: 'pointer to pointer to int' */ c99_6_7_6_example_c(arg); - /* expect+1: argument is incompatible with prototype, arg #1 */ + /* 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? */ c99_6_7_6_example_e(arg); + /* TODO: C99 says 'function with no parameter specification returning a pointer to int' */ /* FIXME: no warning or error at all for an undefined function? */ c99_6_7_6_example_f(arg); - /* expect+1: argument is incompatible with prototype, arg #1 */ + /* TODO: fix type_name to generate '(void)' in this case */ + /* expect+1: 'pointer to function() returning int' */ c99_6_7_6_example_g(arg); - /* expect+1: argument is incompatible with prototype, arg #1 */ + /* expect+1: 'pointer to const pointer to function(unsigned int, ...) returning int' */ c99_6_7_6_example_h(arg); } Index: src/tests/usr.bin/xlint/lint1/msg_155.exp diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.3 Mon Jun 28 10:07:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.exp Mon Jun 28 10:23:50 2021 @@ -1,7 +1,7 @@ msg_155.c(11): error: syntax error ']' [249] -msg_155.c(25): warning: argument is incompatible with prototype, arg #1 [155] -msg_155.c(28): warning: argument is incompatible with prototype, arg #1 [155] -msg_155.c(31): warning: argument is incompatible with prototype, arg #1 [155] -msg_155.c(34): warning: argument is incompatible with prototype, arg #1 [155] -msg_155.c(43): warning: argument is incompatible with prototype, arg #1 [155] -msg_155.c(46): warning: argument is incompatible with prototype, arg #1 [155] +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(47): warning: passing 'struct incompatible' to incompatible 'pointer to function() returning int', arg #1 [155] +msg_155.c(50): 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/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.120 src/usr.bin/xlint/lint1/err.c:1.121 --- src/usr.bin/xlint/lint1/err.c:1.120 Sun Jun 27 19:10:29 2021 +++ src/usr.bin/xlint/lint1/err.c Mon Jun 28 10:23:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.120 2021/06/27 19:10:29 rillig Exp $ */ +/* $NetBSD: err.c,v 1.121 2021/06/28 10:23:49 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.120 2021/06/27 19:10:29 rillig Exp $");
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 10:07:43 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp src/usr.bin/xlint/lint1: decl.c Log Message: lint: turn null pointer dereference into assertion failure Originally I only needed a message that would output the type name from an abstract-declarator (C99 6.7.6), to see whether lint interprets the types correctly. Message 155 looked like a good candidate, but it only revealed more incomplete and untested code in lint. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.191 -r1.192 src/usr.bin/xlint/lint1/decl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 10:07:43 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_155.c msg_155.exp src/usr.bin/xlint/lint1: decl.c Log Message: lint: turn null pointer dereference into assertion failure Originally I only needed a message that would output the type name from an abstract-declarator (C99 6.7.6), to see whether lint interprets the types correctly. Message 155 looked like a good candidate, but it only revealed more incomplete and untested code in lint. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_155.c \ src/tests/usr.bin/xlint/lint1/msg_155.exp cvs rdiff -u -r1.191 -r1.192 src/usr.bin/xlint/lint1/decl.c 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.2 src/tests/usr.bin/xlint/lint1/msg_155.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_155.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.c Mon Jun 28 10:07:43 2021 @@ -1,7 +1,47 @@ -/* $NetBSD: msg_155.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_155.c,v 1.3 2021/06/28 10:07:43 rillig Exp $ */ # 3 "msg_155.c" // Test for message: argument is incompatible with prototype, arg #%d [155] +// TODO: Add type information to the message -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +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 */ +// 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)); +void c99_6_7_6_example_h(int (*const[])(unsigned int, ...)); + +struct incompatible { + int member; +}; + +void +provoke_error_messages(struct incompatible arg) +{ + /* expect+1: argument is incompatible with prototype, arg #1 */ + c99_6_7_6_example_a(arg); + + /* expect+1: argument is incompatible with prototype, arg #1 */ + c99_6_7_6_example_b(arg); + + /* expect+1: argument is incompatible with prototype, arg #1 */ + c99_6_7_6_example_c(arg); + + /* expect+1: argument is incompatible with prototype, arg #1 */ + c99_6_7_6_example_d(arg); + + /* FIXME: no warning or error at all for an undefined function? */ + c99_6_7_6_example_e(arg); + + /* FIXME: no warning or error at all for an undefined function? */ + c99_6_7_6_example_f(arg); + + /* expect+1: argument is incompatible with prototype, arg #1 */ + c99_6_7_6_example_g(arg); + + /* expect+1: argument is incompatible with prototype, arg #1 */ + c99_6_7_6_example_h(arg); +} Index: src/tests/usr.bin/xlint/lint1/msg_155.exp diff -u src/tests/usr.bin/xlint/lint1/msg_155.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_155.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_155.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_155.exp Mon Jun 28 10:07:43 2021 @@ -1 +1,7 @@ -msg_155.c(6): error: syntax error ':' [249] +msg_155.c(11): error: syntax error ']' [249] +msg_155.c(25): warning: argument is incompatible with prototype, arg #1 [155] +msg_155.c(28): warning: argument is incompatible with prototype, arg #1 [155] +msg_155.c(31): warning: argument is incompatible with prototype, arg #1 [155] +msg_155.c(34): warning: argument is incompatible with prototype, arg #1 [155] +msg_155.c(43): warning: argument is incompatible with prototype, arg #1 [155] +msg_155.c(46): warning: argument is incompatible with prototype, arg #1 [155] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.191 src/usr.bin/xlint/lint1/decl.c:1.192 --- src/usr.bin/xlint/lint1/decl.c:1.191 Mon Jun 28 09:14:42 2021 +++ src/usr.bin/xlint/lint1/decl.c Mon Jun 28 10:07:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.191 2021/06/28 09:14:42 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.192 2021/06/28 10:07:43 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.191 2021/06/28 09:14:42 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.192 2021/06/28 10:07:43 rillig Exp $"); #endif #include @@ -2433,6 +2433,7 @@ declare_argument(sym_t *sym, bool initfl error(52, sym->s_name); } + lint_assert(sym->s_type != NULL); if ((t = sym->s_type->t_tspec) == ARRAY) { sym->s_type = derive_type(sym->s_type->t_subt, PTR); } else if (t == FUNC) {
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 09:40:53 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: rename grammar rules for abstract declarators The previous name 'decl' was ambiguous, it could have meant declaration as well as declarator. The new names are aligned with C99. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 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/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.245 src/usr.bin/xlint/lint1/cgram.y:1.246 --- src/usr.bin/xlint/lint1/cgram.y:1.245 Mon Jun 28 09:14:42 2021 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 28 09:40:52 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.245 2021/06/28 09:14:42 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.246 2021/06/28 09:40:52 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.245 2021/06/28 09:14:42 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.246 2021/06/28 09:40:52 rillig Exp $"); #endif #include @@ -318,8 +318,8 @@ anonymize(sym_t *s) %type type_qualifier_list %type type_qualifier %type identifier_list -%type abstract_decl -%type direct_abstract_decl +%type abstract_declarator +%type direct_abstract_declarator %type vararg_parameter_type_list %type parameter_type_list %type parameter_declaration @@ -1329,10 +1329,10 @@ parameter_declaration: | declaration_specifiers deftyp param_decl { $$ = declare_argument($3, false); } - | declmods deftyp abstract_decl { + | declmods deftyp abstract_declarator { $$ = declare_argument($3, false); } - | declaration_specifiers deftyp abstract_decl { + | declaration_specifiers deftyp abstract_declarator { $$ = declare_argument($3, false); } ; @@ -1425,7 +1425,7 @@ init_rbrace: } ; -type_name: +type_name: /* C99 6.7.6 */ { begin_declaration_level(ABSTRACT); } abstract_declaration { @@ -1441,30 +1441,29 @@ abstract_declaration: | noclass_declspecs deftyp { $$ = declare_1_abstract(abstract_name()); } - | noclass_declmods deftyp abstract_decl { + | noclass_declmods deftyp abstract_declarator { $$ = declare_1_abstract($3); } - | noclass_declspecs deftyp abstract_decl { + | noclass_declspecs deftyp abstract_declarator { $$ = declare_1_abstract($3); } ; -/* TODO: abstract_declaration and abstract_decl sound too similar */ -abstract_decl: +abstract_declarator: /* C99 6.7.6 */ pointer { $$ = add_pointer(abstract_name(), $1); } - | direct_abstract_decl - | pointer direct_abstract_decl { + | direct_abstract_declarator + | pointer direct_abstract_declarator { $$ = add_pointer($2, $1); } - | T_TYPEOF term { + | T_TYPEOF term { /* GCC extension */ $$ = mktempsym($2->tn_type); } ; -direct_abstract_decl: - T_LPAREN abstract_decl T_RPAREN { +direct_abstract_declarator: + T_LPAREN abstract_declarator T_RPAREN { $$ = $2; } | T_LBRACK T_RBRACK { @@ -1473,13 +1472,13 @@ direct_abstract_decl: | T_LBRACK array_size T_RBRACK { $$ = add_array(abstract_name(), true, to_int_constant($2, false)); } - | type_attribute direct_abstract_decl { + | type_attribute direct_abstract_declarator { $$ = $2; } - | direct_abstract_decl T_LBRACK T_RBRACK { + | direct_abstract_declarator T_LBRACK T_RBRACK { $$ = add_array($1, false, 0); } - | direct_abstract_decl T_LBRACK array_size T_RBRACK { + | direct_abstract_declarator T_LBRACK array_size T_RBRACK { $$ = add_array($1, true, to_int_constant($3, false)); } | abstract_decl_param_list asm_or_symbolrename_opt { @@ -1487,12 +1486,12 @@ direct_abstract_decl: end_declaration_level(); block_level--; } - | direct_abstract_decl abstract_decl_param_list asm_or_symbolrename_opt { + | direct_abstract_declarator abstract_decl_param_list asm_or_symbolrename_opt { $$ = add_function(symbolrename($1, $3), $2); end_declaration_level(); block_level--; } - | direct_abstract_decl type_attribute_list + | direct_abstract_declarator type_attribute_list ; non_expr_statement:
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 09:40:53 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: rename grammar rules for abstract declarators The previous name 'decl' was ambiguous, it could have meant declaration as well as declarator. The new names are aligned with C99. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 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.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 09:14:42 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c Log Message: lint: align grammar with C99 C99 uses type-qualifier-list_opt in section 6.7.5. To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.190 -r1.191 src/usr.bin/xlint/lint1/decl.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.244 src/usr.bin/xlint/lint1/cgram.y:1.245 --- src/usr.bin/xlint/lint1/cgram.y:1.244 Mon Jun 28 09:01:48 2021 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 28 09:14:42 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.244 2021/06/28 09:01:48 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.245 2021/06/28 09:14:42 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.244 2021/06/28 09:01:48 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.245 2021/06/28 09:14:42 rillig Exp $"); #endif #include @@ -314,6 +314,7 @@ anonymize(sym_t *s) %type direct_param_decl %type notype_param_decl %type direct_notype_param_decl +%type type_qualifier_list_opt %type type_qualifier_list %type type_qualifier %type identifier_list @@ -1132,11 +1133,6 @@ param_decl: } ; -type_qualifier_list_opt: - /* empty */ - | type_qualifier_list - ; - array_size: type_qualifier_list_opt T_SCLASS constant_expr { /* C11 6.7.6.3p7 */ @@ -1200,14 +1196,10 @@ direct_notype_param_decl: ; pointer: /* C99 6.7.5 */ - asterisk - | asterisk type_qualifier_list { - $$ = merge_qualified_pointer($1, $2); - } - | asterisk pointer { + asterisk type_qualifier_list_opt { $$ = merge_qualified_pointer($1, $2); } - | asterisk type_qualifier_list pointer { + | asterisk type_qualifier_list_opt pointer { $$ = merge_qualified_pointer($1, $2); $$ = merge_qualified_pointer($$, $3); } @@ -1220,8 +1212,14 @@ asterisk: } ; -/* TODO: try whether type_qualifier_list_opt makes the code simpler */ -type_qualifier_list: +type_qualifier_list_opt: + /* empty */ { + $$ = NULL; + } + | type_qualifier_list + ; + +type_qualifier_list: /* C99 6.7.5 */ type_qualifier | type_qualifier_list type_qualifier { $$ = merge_qualified_pointer($1, $2); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.190 src/usr.bin/xlint/lint1/decl.c:1.191 --- src/usr.bin/xlint/lint1/decl.c:1.190 Mon Jun 28 08:52:55 2021 +++ src/usr.bin/xlint/lint1/decl.c Mon Jun 28 09:14:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.190 2021/06/28 08:52:55 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.191 2021/06/28 09:14:42 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.190 2021/06/28 08:52:55 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.191 2021/06/28 09:14:42 rillig Exp $"); #endif #include @@ -1296,6 +1296,9 @@ merge_qualified_pointer(qual_ptr *p1, qu { qual_ptr *tail; + if (p2 == NULL) + return p1; /* for optional qualifiers */ + if (p2->p_pointer) { /* append p1 to p2, keeping p2 */ for (tail = p2; tail->p_next != NULL; tail = tail->p_next)
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 09:14:42 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c Log Message: lint: align grammar with C99 C99 uses type-qualifier-list_opt in section 6.7.5. To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.190 -r1.191 src/usr.bin/xlint/lint1/decl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/gpl3/gcc/dist/gcc
Module Name:src Committed By: cjep Date: Mon Jun 28 09:13:11 UTC 2021 Modified Files: src/external/gpl3/gcc/dist/gcc: config.host Log Message: PR toolchain/56180. Add configuration so that gcc can find the LTO plugin when cross-building NetBSD from OpenBSD hosts. Discussed with mrg. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/dist/gcc/config.host Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc/dist/gcc/config.host diff -u src/external/gpl3/gcc/dist/gcc/config.host:1.10 src/external/gpl3/gcc/dist/gcc/config.host:1.11 --- src/external/gpl3/gcc/dist/gcc/config.host:1.10 Sun Apr 11 00:02:11 2021 +++ src/external/gpl3/gcc/dist/gcc/config.host Mon Jun 28 09:13:10 2021 @@ -277,6 +277,7 @@ case ${host} in *-*-openbsd*) out_host_hook_obj=host-openbsd.o host_xmake_file="${host_xmake_file} x-openbsd" +host_lto_plugin_soname=liblto_plugin.so.0.0 ;; *-*-netbsd*) out_host_hook_obj=host-netbsd.o
CVS commit: src/external/gpl3/gcc/dist/gcc
Module Name:src Committed By: cjep Date: Mon Jun 28 09:13:11 UTC 2021 Modified Files: src/external/gpl3/gcc/dist/gcc: config.host Log Message: PR toolchain/56180. Add configuration so that gcc can find the LTO plugin when cross-building NetBSD from OpenBSD hosts. Discussed with mrg. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/dist/gcc/config.host Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: mrg Date: Mon Jun 28 09:09:14 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: Makefile Log Message: apply sh3 vs lex.c fix for GCC >= 9. use shorter idiom. fixes build issue reported by jdbaker in private email. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/xlint/lint1/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: mrg Date: Mon Jun 28 09:09:14 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: Makefile Log Message: apply sh3 vs lex.c fix for GCC >= 9. use shorter idiom. fixes build issue reported by jdbaker in private email. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/usr.bin/xlint/lint1/Makefile 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/Makefile diff -u src/usr.bin/xlint/lint1/Makefile:1.73 src/usr.bin/xlint/lint1/Makefile:1.74 --- src/usr.bin/xlint/lint1/Makefile:1.73 Fri Jun 25 20:17:56 2021 +++ src/usr.bin/xlint/lint1/Makefile Mon Jun 28 09:09:14 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.73 2021/06/25 20:17:56 tnn Exp $ +# $NetBSD: Makefile,v 1.74 2021/06/28 09:09:14 mrg Exp $ .include @@ -28,7 +28,7 @@ CPPFLAGS+= ${DEBUG:D-DDEBUG} COPTS.err.c+= ${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :} # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101177 -.if defined(HAVE_GCC) && ${HAVE_GCC} == 9 && \ +.if ${HAVE_GCC:U0} >= 9 && \ (${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb") COPTS.lex.c+= -O0 .endif
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 09:01:48 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: refrain from renaming the grammar rule 'pointer' That rule is called 'pointer' by C99 as well. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.243 -r1.244 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/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.243 src/usr.bin/xlint/lint1/cgram.y:1.244 --- src/usr.bin/xlint/lint1/cgram.y:1.243 Mon Jun 28 08:52:55 2021 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 28 09:01:48 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.243 2021/06/28 08:52:55 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.244 2021/06/28 09:01:48 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.243 2021/06/28 08:52:55 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.244 2021/06/28 09:01:48 rillig Exp $"); #endif #include @@ -1199,8 +1199,7 @@ direct_notype_param_decl: } ; -/* TODO: rename 'pointer' to something less ambiguous, maybe 'pointer_level' */ -pointer: +pointer: /* C99 6.7.5 */ asterisk | asterisk type_qualifier_list { $$ = merge_qualified_pointer($1, $2);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 09:01:48 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: refrain from renaming the grammar rule 'pointer' That rule is called 'pointer' by C99 as well. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.243 -r1.244 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.
CVS commit: src/common/lib/libc/arch/arm/atomic
Module Name:src Committed By: skrll Date: Mon Jun 28 09:00:45 UTC 2021 Modified Files: src/common/lib/libc/arch/arm/atomic: atomic_add_64.S atomic_and_64.S atomic_nand_64.S atomic_or_64.S atomic_sub_64.S atomic_swap_64.S atomic_xor_64.S Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S cvs rdiff -u -r1.10 -r1.11 \ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_xor_64.S cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_sub_64.S cvs rdiff -u -r1.12 -r1.13 \ src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/atomic/atomic_add_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.11 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.12 --- src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.11 Tue Mar 4 16:15:28 2014 +++ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S Mon Jun 28 09:00:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_add_64.S,v 1.11 2014/03/04 16:15:28 matt Exp $ */ +/* $NetBSD: atomic_add_64.S,v 1.12 2021/06/28 09:00:45 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -33,7 +33,7 @@ #ifdef _ARM_ARCH_6 ENTRY_NP(_atomic_add_64_nv) - push {r3,r4} /* save temporary */ + push {r3, r4} /* save temporary */ mov ip, r0 /* need r0 for return value */ #ifndef __ARM_EABI__ mov r3, r2 @@ -50,7 +50,7 @@ ENTRY_NP(_atomic_add_64_nv) #else mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ #endif - pop {r3,r4} /* restore temporary */ + pop {r3, r4} /* restore temporary */ RET/* return new value */ END(_atomic_add_64_nv) Index: src/common/lib/libc/arch/arm/atomic/atomic_or_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.11 src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.12 --- src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.11 Sun Sep 15 14:55:04 2019 +++ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S Mon Jun 28 09:00:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_or_64.S,v 1.11 2019/09/15 14:55:04 skrll Exp $ */ +/* $NetBSD: atomic_or_64.S,v 1.12 2021/06/28 09:00:45 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -33,7 +33,7 @@ #ifdef _ARM_ARCH_6 ENTRY_NP(_atomic_or_64_nv) - push {r3,r4} /* save temporary */ + push {r3, r4} /* save temporary */ #ifndef __ARM_EABI__ mov r3, r2 mov r2, r1 @@ -50,7 +50,7 @@ ENTRY_NP(_atomic_or_64_nv) #else mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ #endif - pop {r3,r4} /* restore temporary */ + pop {r3, r4} /* restore temporary */ RET/* return new value */ END(_atomic_or_64_nv) Index: src/common/lib/libc/arch/arm/atomic/atomic_and_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.10 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.11 --- src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.10 Tue Mar 4 16:15:28 2014 +++ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S Mon Jun 28 09:00:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_and_64.S,v 1.10 2014/03/04 16:15:28 matt Exp $ */ +/* $NetBSD: atomic_and_64.S,v 1.11 2021/06/28 09:00:45 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -33,7 +33,7 @@ #ifdef _ARM_ARCH_6 ENTRY_NP(_atomic_and_64_nv) - push {r3,r4} /* save temporary */ + push {r3, r4} /* save temporary */ #ifndef __ARM_EABI__ mov r3, r2 mov r2, r1 @@ -50,7 +50,7 @@ ENTRY_NP(_atomic_and_64_nv) #else mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ #endif - pop {r3,r4} /* restore temporary */ + pop {r3, r4} /* restore temporary */ RET/* return new value */ END(_atomic_and_64_nv) Index: src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S:1.5 --- src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S:1.4 Fri Dec 11 12:41:10 2015 +++ src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S Mon Jun 28 09:00:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_nand_64.S,v 1.4 2015/12/11 12:41:10 skrll Exp $ */ +/* $NetBSD: atomic_nand_64.S,v 1.5 2021/06/28 09:00:45 skrll Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. * All rights reserved. @@ -33,7 +33,7 @@ #ifdef _ARM_ARCH_6 ENTRY_NP(_atomic_nand_64_nv) - push {r3,r4} /* save temporary */ + push {r3, r4} /* save temporary */ #ifndef __ARM_EABI__ mov r3, r2 mov r2, r1 @@ -52,7 +52,7 @@ ENTRY_NP(_atomic_nand_64_nv) #else mcr p15, 0, r4, c7, c10, 5 /*
CVS commit: src/common/lib/libc/arch/arm/atomic
Module Name:src Committed By: skrll Date: Mon Jun 28 09:00:45 UTC 2021 Modified Files: src/common/lib/libc/arch/arm/atomic: atomic_add_64.S atomic_and_64.S atomic_nand_64.S atomic_or_64.S atomic_sub_64.S atomic_swap_64.S atomic_xor_64.S Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S cvs rdiff -u -r1.10 -r1.11 \ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_nand_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_xor_64.S cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_sub_64.S cvs rdiff -u -r1.12 -r1.13 \ src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 08:52:56 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c externs1.h lint1.h Log Message: lint: rename pqinf_t to qual_ptr and clean up code The 'inf' from the type name meant 'information' and was redundant. Each object of that type represents a single pointer level, which made the documentation about 'pointers' a bit confusing. The members of struct qual_ptr are now in the canonical reading order, which is 'const volatile pointer'. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.242 -r1.243 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.189 -r1.190 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.112 -r1.113 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.107 -r1.108 src/usr.bin/xlint/lint1/lint1.h 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.242 src/usr.bin/xlint/lint1/cgram.y:1.243 --- src/usr.bin/xlint/lint1/cgram.y:1.242 Mon Jun 28 07:55:05 2021 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 28 08:52:55 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.242 2021/06/28 07:55:05 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.243 2021/06/28 08:52:55 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.242 2021/06/28 07:55:05 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.243 2021/06/28 08:52:55 rillig Exp $"); #endif #include @@ -137,7 +137,7 @@ anonymize(sym_t *s) tnode_t *y_tnode; range_t y_range; strg_t *y_string; - pqinf_t *y_pqinf; + qual_ptr *y_qual_ptr; bool y_seen_statement; struct generic_association_types *y_types; }; @@ -306,16 +306,16 @@ anonymize(sym_t *s) %type enumeration_constant %type notype_direct_decl %type type_direct_decl -%type pointer -%type asterisk +%type pointer +%type asterisk %type param_decl %type param_list %type abstract_decl_param_list %type direct_param_decl %type notype_param_decl %type direct_notype_param_decl -%type type_qualifier_list -%type type_qualifier +%type type_qualifier_list +%type type_qualifier %type identifier_list %type abstract_decl %type direct_abstract_decl @@ -1203,16 +1203,14 @@ direct_notype_param_decl: pointer: asterisk | asterisk type_qualifier_list { - /* TODO: rename pqinf_t to be more expressive */ - /* TODO: then rename the merge function */ - $$ = merge_pointers_and_qualifiers($1, $2); + $$ = merge_qualified_pointer($1, $2); } | asterisk pointer { - $$ = merge_pointers_and_qualifiers($1, $2); + $$ = merge_qualified_pointer($1, $2); } | asterisk type_qualifier_list pointer { - $$ = merge_pointers_and_qualifiers($1, $2); - $$ = merge_pointers_and_qualifiers($$, $3); + $$ = merge_qualified_pointer($1, $2); + $$ = merge_qualified_pointer($$, $3); } ; @@ -1227,7 +1225,7 @@ asterisk: type_qualifier_list: type_qualifier | type_qualifier_list type_qualifier { - $$ = merge_pointers_and_qualifiers($1, $2); + $$ = merge_qualified_pointer($1, $2); } ; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.189 src/usr.bin/xlint/lint1/decl.c:1.190 --- src/usr.bin/xlint/lint1/decl.c:1.189 Sun Jun 27 08:20:50 2021 +++ src/usr.bin/xlint/lint1/decl.c Mon Jun 28 08:52:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.189 2021/06/27 08:20:50 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.190 2021/06/28 08:52:55 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.189 2021/06/27 08:20:50 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.190 2021/06/28 08:52:55 rillig Exp $"); #endif #include @@ -1286,40 +1286,41 @@ bitfield(sym_t *dsym, int len) } /* - * Collect information about a sequence of asterisks and qualifiers in a - * list of type pqinf_t. - * Qualifiers always refer to the left asterisk. - * The rightmost asterisk will be at the top of the list. + * A sequence of asterisks and qualifiers, from right to left. For example, + * 'const ***volatile **const volatile' results in [cvp, p, vp, p, p]. The + * leftmost 'const' is not included in this list, it is stored in dcs->d_const + * instead. */ -pqinf_t * -merge_pointers_and_qualifiers(pqinf_t *p1, pqinf_t *p2) +qual_ptr * +merge_qualified_pointer(qual_ptr *p1, qual_ptr *p2) { - pqinf_t *p; + qual_ptr *tail; if (p2->p_pointer) { - /* left '*' at the end of the list */ - for (p = p2; p->p_next != NULL; p = p->p_next) + /* append p1 to p2, keeping p2 */ + for (tail = p2; tail->p_next != NULL; tail = tail->p_next) continue; - p->p_next = p1; + tail->p_next = p1; return p2; - } else { - if
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Mon Jun 28 08:52:56 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y decl.c externs1.h lint1.h Log Message: lint: rename pqinf_t to qual_ptr and clean up code The 'inf' from the type name meant 'information' and was redundant. Each object of that type represents a single pointer level, which made the documentation about 'pointers' a bit confusing. The members of struct qual_ptr are now in the canonical reading order, which is 'const volatile pointer'. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.242 -r1.243 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.189 -r1.190 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.112 -r1.113 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.107 -r1.108 src/usr.bin/xlint/lint1/lint1.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 07:55:05 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: c11_generic_expression.c src/usr.bin/xlint/lint1: cgram.y Log Message: lint: only accept assignment-expression in _Generic That's what C11 says. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/tests/usr.bin/xlint/lint1/c11_generic_expression.c cvs rdiff -u -r1.241 -r1.242 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/c11_generic_expression.c diff -u src/tests/usr.bin/xlint/lint1/c11_generic_expression.c:1.5 src/tests/usr.bin/xlint/lint1/c11_generic_expression.c:1.6 --- src/tests/usr.bin/xlint/lint1/c11_generic_expression.c:1.5 Sun Jun 27 21:30:46 2021 +++ src/tests/usr.bin/xlint/lint1/c11_generic_expression.c Mon Jun 28 07:55:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: c11_generic_expression.c,v 1.5 2021/06/27 21:30:46 rillig Exp $ */ +/* $NetBSD: c11_generic_expression.c,v 1.6 2021/06/28 07:55:05 rillig Exp $ */ # 3 "c11_generic_expression.c" /* @@ -75,3 +75,16 @@ comma_expression(char first, double seco ); /* expect+1: without returning value [217] */ } + +/* + * Ensure that assignment-expressions are accepted by the grammar, as + * opposed to comma-expressions. + */ +/* ARGSUSED */ +int +assignment_expression(int first, int second) +{ + return _Generic(first = second, + int: second = first + ); +} Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.241 src/usr.bin/xlint/lint1/cgram.y:1.242 --- src/usr.bin/xlint/lint1/cgram.y:1.241 Sun Jun 27 21:52:18 2021 +++ src/usr.bin/xlint/lint1/cgram.y Mon Jun 28 07:55:05 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.241 2021/06/27 21:52:18 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.242 2021/06/28 07:55:05 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.241 2021/06/27 21:52:18 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.242 2021/06/28 07:55:05 rillig Exp $"); #endif #include @@ -1659,12 +1659,12 @@ generic_assoc_list: /* C11 6.5.1.1 */ ; generic_association: /* C11 6.5.1.1 */ - type_name T_COLON expr { + type_name T_COLON assignment_expression { $$ = getblk(sizeof(*$$)); $$->gat_arg = $1; $$->gat_result = $3; } - | T_DEFAULT T_COLON expr { + | T_DEFAULT T_COLON assignment_expression { $$ = getblk(sizeof(*$$)); $$->gat_arg = NULL; $$->gat_result = $3;
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Jun 28 07:55:05 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: c11_generic_expression.c src/usr.bin/xlint/lint1: cgram.y Log Message: lint: only accept assignment-expression in _Generic That's what C11 says. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/tests/usr.bin/xlint/lint1/c11_generic_expression.c cvs rdiff -u -r1.241 -r1.242 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.
CVS commit: src/tools/compat
Module Name:src Committed By: cjep Date: Mon Jun 28 07:18:01 UTC 2021 Modified Files: src/tools/compat: README Log Message: avoid triggering conflict indicator warnings To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tools/compat/README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/compat/README diff -u src/tools/compat/README:1.17 src/tools/compat/README:1.18 --- src/tools/compat/README:1.17 Mon Jun 28 07:16:46 2021 +++ src/tools/compat/README Mon Jun 28 07:18:01 2021 @@ -1,4 +1,4 @@ -$NetBSD: README,v 1.17 2021/06/28 07:16:46 cjep Exp $ +$NetBSD: README,v 1.18 2021/06/28 07:18:01 cjep Exp $ Special notes for cross-hosting a NetBSD build on certain platforms. Only those platforms which have been tested to complete a "build.sh" run @@ -14,7 +14,7 @@ In addition all hosts must provide the f zlib and headers (this requirement may be dropped in future) FreeBSD -=== +--- build.sh was recently tested on: * FreeBSD 13 (amd64, aarch64) @@ -23,7 +23,7 @@ build.sh was recently tested on: * FreeBSD 10.4 (amd64) Linux -= +- build.sh has been tested on: * Amazon Linux 2 (x86) @@ -45,7 +45,7 @@ build.sh has been tested on: * There is a known build problem on Linux/aarch64 with glibc <2.28 macOS/Darwin - + build.sh was recently tested on: * macOS Big Sur (x86) @@ -57,12 +57,12 @@ Previously, there have been issues build HFS filesystems. build.sh is not working yet on M1-based Macs. HP-UX -= +- * zlib must be available. NetBSD (earlier releases) -= +- * Tested on NetBSD 1.5.2 (machine-independently). * Should need no special setup. @@ -70,7 +70,7 @@ NetBSD (earlier releases) compat_defs.h will error out if it finds it defined. Solaris -=== +--- (updated instruction for Solaris 11 further below)
CVS commit: src/tools/compat
Module Name:src Committed By: cjep Date: Mon Jun 28 07:18:01 UTC 2021 Modified Files: src/tools/compat: README Log Message: avoid triggering conflict indicator warnings To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tools/compat/README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tools/compat
Module Name:src Committed By: cjep Date: Mon Jun 28 07:16:46 UTC 2021 Modified Files: src/tools/compat: README Log Message: note on Darwin/Mac To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tools/compat/README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/compat/README diff -u src/tools/compat/README:1.16 src/tools/compat/README:1.17 --- src/tools/compat/README:1.16 Wed May 12 06:39:28 2021 +++ src/tools/compat/README Mon Jun 28 07:16:46 2021 @@ -1,4 +1,4 @@ -$NetBSD: README,v 1.16 2021/05/12 06:39:28 cjep Exp $ +$NetBSD: README,v 1.17 2021/06/28 07:16:46 cjep Exp $ Special notes for cross-hosting a NetBSD build on certain platforms. Only those platforms which have been tested to complete a "build.sh" run @@ -48,13 +48,13 @@ macOS/Darwin build.sh was recently tested on: -* macOS Big Sur +* macOS Big Sur (x86) * macOS Catalina * macOS High Sierra -with up to date Xcode command line tools and APFS filesystems. -(Previously, there have been issues building on case-insensitive -HFS filesystems.) +with up to date Xcode command line tools and APFS filesystems. +Previously, there have been issues building on case-insensitive +HFS filesystems. build.sh is not working yet on M1-based Macs. HP-UX =
CVS commit: src/tools/compat
Module Name:src Committed By: cjep Date: Mon Jun 28 07:16:46 UTC 2021 Modified Files: src/tools/compat: README Log Message: note on Darwin/Mac To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tools/compat/README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.