CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 22:43:08 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_342.c msg_342.exp src/usr.bin/xlint/lint1: ckctype.c Log Message: lint: split is_ctype_function into separate parts This reduces the number of string comparisons for function names that start with 'is' or 'to'. The tests now cover function names that start with 'is' or 'to' but are not one of the well-known functions from ctype.h. This removes the '*' in the output from gcov. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_342.c \ src/tests/usr.bin/xlint/lint1/msg_342.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint1/ckctype.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_342.c diff -u src/tests/usr.bin/xlint/lint1/msg_342.c:1.2 src/tests/usr.bin/xlint/lint1/msg_342.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_342.c:1.2 Sun Jul 25 22:31:22 2021 +++ src/tests/usr.bin/xlint/lint1/msg_342.c Sun Jul 25 22:43:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_342.c,v 1.2 2021/07/25 22:31:22 rillig Exp $ */ +/* $NetBSD: msg_342.c,v 1.3 2021/07/25 22:43:08 rillig Exp $ */ # 3 "msg_341.c" // Test for message: argument to '%s' must be cast to 'unsigned char', not to '%s' [342] @@ -27,6 +27,9 @@ int isxdigit(int); int tolower(int); int toupper(int); +int is_other(int); +int to_other(int); + void sink(int); void @@ -60,6 +63,10 @@ cover_is_ctype_function(char c) tolower(c); /* expect+1: warning: argument to 'toupper' must be 'unsigned char' or EOF, not 'char' [341] */ toupper(c); + + /* Functions with similar names are not checked. */ + is_other(c); + to_other(c); } void Index: src/tests/usr.bin/xlint/lint1/msg_342.exp diff -u src/tests/usr.bin/xlint/lint1/msg_342.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_342.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_342.exp:1.2 Sun Jul 25 22:31:22 2021 +++ src/tests/usr.bin/xlint/lint1/msg_342.exp Sun Jul 25 22:43:08 2021 @@ -1,20 +1,20 @@ -msg_341.c(36): warning: argument to 'isalnum' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(38): warning: argument to 'isalpha' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(40): warning: argument to 'isblank' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(42): warning: argument to 'iscntrl' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(44): warning: argument to 'isdigit' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(46): warning: argument to 'isgraph' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(48): warning: argument to 'islower' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(50): warning: argument to 'isprint' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(52): warning: argument to 'ispunct' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(54): warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(56): warning: argument to 'isupper' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(58): warning: argument to 'isxdigit' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(60): warning: argument to 'tolower' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(62): warning: argument to 'toupper' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(70): warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(79): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'int' [342] -msg_341.c(82): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'unsigned int' [342] -msg_341.c(113): warning: argument to 'function from ' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(119): warning: argument to 'function from ' must be cast to 'unsigned char', not to 'int' [342] -msg_341.c(122): warning: argument to 'function from ' must be cast to 'unsigned char', not to 'unsigned int' [342] +msg_341.c(39): warning: argument to 'isalnum' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(41): warning: argument to 'isalpha' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(43): warning: argument to 'isblank' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(45): warning: argument to 'iscntrl' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(47): warning: argument to 'isdigit' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(49): warning: argument to 'isgraph' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(51): warning: argument to 'islower' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(53): warning: argument to 'isprint' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(55): warning: argument to 'ispunct' must be 'unsigned char' or EOF, not
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 22:31:22 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_342.c msg_342.exp Log Message: tests/lint: cover code in ckctype.c To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_342.c \ src/tests/usr.bin/xlint/lint1/msg_342.exp 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_342.c diff -u src/tests/usr.bin/xlint/lint1/msg_342.c:1.1 src/tests/usr.bin/xlint/lint1/msg_342.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_342.c:1.1 Mon Apr 5 02:05:47 2021 +++ src/tests/usr.bin/xlint/lint1/msg_342.c Sun Jul 25 22:31:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_342.c,v 1.1 2021/04/05 02:05:47 rillig Exp $ */ +/* $NetBSD: msg_342.c,v 1.2 2021/07/25 22:31:22 rillig Exp $ */ # 3 "msg_341.c" // Test for message: argument to '%s' must be cast to 'unsigned char', not to '%s' [342] @@ -12,11 +12,57 @@ extern const unsigned short *_ctype_tab_; extern const short *_tolower_tab_; extern const short *_toupper_tab_; +int isalnum(int); +int isalpha(int); +int isblank(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); int isspace(int); +int isupper(int); +int isxdigit(int); +int tolower(int); +int toupper(int); void sink(int); void +cover_is_ctype_function(char c) +{ + /* expect+1: warning: argument to 'isalnum' must be 'unsigned char' or EOF, not 'char' [341] */ + isalnum(c); + /* expect+1: warning: argument to 'isalpha' must be 'unsigned char' or EOF, not 'char' [341] */ + isalpha(c); + /* expect+1: warning: argument to 'isblank' must be 'unsigned char' or EOF, not 'char' [341] */ + isblank(c); + /* expect+1: warning: argument to 'iscntrl' must be 'unsigned char' or EOF, not 'char' [341] */ + iscntrl(c); + /* expect+1: warning: argument to 'isdigit' must be 'unsigned char' or EOF, not 'char' [341] */ + isdigit(c); + /* expect+1: warning: argument to 'isgraph' must be 'unsigned char' or EOF, not 'char' [341] */ + isgraph(c); + /* expect+1: warning: argument to 'islower' must be 'unsigned char' or EOF, not 'char' [341] */ + islower(c); + /* expect+1: warning: argument to 'isprint' must be 'unsigned char' or EOF, not 'char' [341] */ + isprint(c); + /* expect+1: warning: argument to 'ispunct' must be 'unsigned char' or EOF, not 'char' [341] */ + ispunct(c); + /* expect+1: warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341] */ + isspace(c); + /* expect+1: warning: argument to 'isupper' must be 'unsigned char' or EOF, not 'char' [341] */ + isupper(c); + /* expect+1: warning: argument to 'isxdigit' must be 'unsigned char' or EOF, not 'char' [341] */ + isxdigit(c); + /* expect+1: warning: argument to 'tolower' must be 'unsigned char' or EOF, not 'char' [341] */ + tolower(c); + /* expect+1: warning: argument to 'toupper' must be 'unsigned char' or EOF, not 'char' [341] */ + toupper(c); +} + +void function_call_char(char c) { Index: src/tests/usr.bin/xlint/lint1/msg_342.exp diff -u src/tests/usr.bin/xlint/lint1/msg_342.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_342.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_342.exp:1.1 Mon Apr 5 02:05:47 2021 +++ src/tests/usr.bin/xlint/lint1/msg_342.exp Sun Jul 25 22:31:22 2021 @@ -1,6 +1,20 @@ -msg_341.c(24): warning: argument to 'isspace' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(33): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'int' [342] -msg_341.c(36): warning: argument to 'isspace' must be cast to 'unsigned char', not to 'unsigned int' [342] -msg_341.c(67): warning: argument to 'function from ' must be 'unsigned char' or EOF, not 'char' [341] -msg_341.c(73): warning: argument to 'function from ' must be cast to 'unsigned char', not to 'int' [342] -msg_341.c(76): warning: argument to 'function from ' must be cast to 'unsigned char', not to 'unsigned int' [342] +msg_341.c(36): warning: argument to 'isalnum' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(38): warning: argument to 'isalpha' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(40): warning: argument to 'isblank' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(42): warning: argument to 'iscntrl' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(44): warning: argument to 'isdigit' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(46): warning: argument to 'isgraph' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(48): warning: argument to 'islower' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(50): warning: argument to 'isprint' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(52): warning: argument to 'ispunct' must be 'unsigned char' or EOF, not 'char' [341] +msg_341.c(54): warning: argument to 'isspace' must be 'unsigned char' or EOF,
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 22:14:37 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: Makefile decl.c externs1.h Removed Files: src/usr.bin/xlint/lint1: print.c Log Message: lint: move scl_name from print.c to decl.c It is only needed there. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.209 -r1.210 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.120 -r1.121 src/usr.bin/xlint/lint1/externs1.h cvs rdiff -u -r1.15 -r0 src/usr.bin/xlint/lint1/print.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/Makefile diff -u src/usr.bin/xlint/lint1/Makefile:1.79 src/usr.bin/xlint/lint1/Makefile:1.80 --- src/usr.bin/xlint/lint1/Makefile:1.79 Sat Jul 10 09:14:38 2021 +++ src/usr.bin/xlint/lint1/Makefile Sun Jul 25 22:14:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.79 2021/07/10 09:14:38 rillig Exp $ +# $NetBSD: Makefile,v 1.80 2021/07/25 22:14:36 rillig Exp $ .include @@ -6,7 +6,7 @@ PROG= lint1 SRCS= cgram.y \ ckbool.c ckctype.c ckgetopt.c \ decl.c emit.c emit1.c err.c func.c init.c inittyp.c lex.c \ - main1.c mem.c mem1.c oper.c print.c scan.l tree.c tyname.c + main1.c mem.c mem1.c oper.c scan.l tree.c tyname.c MAN= lint.7 YHEADER= Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.209 src/usr.bin/xlint/lint1/decl.c:1.210 --- src/usr.bin/xlint/lint1/decl.c:1.209 Fri Jul 23 16:48:48 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Jul 25 22:14:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.209 2021/07/23 16:48:48 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.210 2021/07/25 22:14:36 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.209 2021/07/23 16:48:48 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.210 2021/07/25 22:14:36 rillig Exp $"); #endif #include @@ -133,6 +133,20 @@ initdecl(void) typetab[UNSIGN].t_tspec = UNSIGN; } +/* Return the name of the "storage class" in the wider sense. */ +static const char * +scl_name(scl_t scl) +{ + static const char *const names[] = { + "none", "extern", "static", "auto", "register", "typedef", + "struct", "union", "enum", "member of struct", "member of union", + "compile-time constant", "abstract", "argument", + "prototype argument", "inline" + }; + + return names[scl]; +} + /* * Returns a shared type structure for arithmetic types and void. * Index: src/usr.bin/xlint/lint1/externs1.h diff -u src/usr.bin/xlint/lint1/externs1.h:1.120 src/usr.bin/xlint/lint1/externs1.h:1.121 --- src/usr.bin/xlint/lint1/externs1.h:1.120 Tue Jul 20 19:44:36 2021 +++ src/usr.bin/xlint/lint1/externs1.h Sun Jul 25 22:14:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: externs1.h,v 1.120 2021/07/20 19:44:36 rillig Exp $ */ +/* $NetBSD: externs1.h,v 1.121 2021/07/25 22:14:36 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -340,11 +340,6 @@ extern void lex_unknown_character(int); extern int lex_input(void); /* - * print.c - */ -const char *scl_name(scl_t); - -/* * ckbool.c */ extern bool typeok_scalar_strict_bool(op_t, const mod_t *, int,
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 22:03:43 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile decl.c decl.exp parse_init_declarator.c parse_type_name.c Added Files: src/tests/usr.bin/xlint/lint1: c90.c c90.exp Log Message: tests/lint: cover every code line in the grammar To generate a diff of this commit: cvs rdiff -u -r1.1095 -r1.1096 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.96 -r1.97 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/c90.c \ src/tests/usr.bin/xlint/lint1/c90.exp cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/decl.exp cvs rdiff -u -r1.2 -r1.3 \ src/tests/usr.bin/xlint/lint1/parse_init_declarator.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/parse_type_name.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1095 src/distrib/sets/lists/tests/mi:1.1096 --- src/distrib/sets/lists/tests/mi:1.1095 Sun Jul 25 17:27:07 2021 +++ src/distrib/sets/lists/tests/mi Sun Jul 25 22:03:42 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1095 2021/07/25 17:27:07 rillig Exp $ +# $NetBSD: mi,v 1.1096 2021/07/25 22:03:42 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6116,6 +6116,8 @@ ./usr/tests/usr.bin/xlint/lint1/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/c90.ctests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/c90.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp tests-obsolete obsolete ./usr/tests/usr.bin/xlint/lint1/c99_init_array.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.96 src/tests/usr.bin/xlint/lint1/Makefile:1.97 --- src/tests/usr.bin/xlint/lint1/Makefile:1.96 Sun Jul 25 17:27:07 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jul 25 22:03:42 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.96 2021/07/25 17:27:07 rillig Exp $ +# $NetBSD: Makefile,v 1.97 2021/07/25 22:03:42 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -18,6 +18,8 @@ archsubdir.sh: FILESDIR= ${TESTSDIR} FILES+= c11_generic_expression.c FILES+= c11_generic_expression.exp +FILES+= c90.c +FILES+= c90.exp FILES+= c99_bool_strict_suppressed.c FILES+= c99_init_array.c FILES+= c99_init_array.exp Index: src/tests/usr.bin/xlint/lint1/decl.c diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.11 src/tests/usr.bin/xlint/lint1/decl.c:1.12 --- src/tests/usr.bin/xlint/lint1/decl.c:1.11 Sun Jul 25 08:42:28 2021 +++ src/tests/usr.bin/xlint/lint1/decl.c Sun Jul 25 22:03:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.11 2021/07/25 08:42:28 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.12 2021/07/25 22:03:42 rillig Exp $ */ # 3 "decl.c" /* @@ -164,3 +164,9 @@ thread int thread_int; __thread int thread_int; /* expect+1: syntax error 'int' [249] */ __thread__ int thread_int; + +/* expect+2: warning: static function cover_func_declarator unused [236] */ +static +cover_func_declarator(void) +{ +} Index: src/tests/usr.bin/xlint/lint1/decl.exp diff -u src/tests/usr.bin/xlint/lint1/decl.exp:1.7 src/tests/usr.bin/xlint/lint1/decl.exp:1.8 --- src/tests/usr.bin/xlint/lint1/decl.exp:1.7 Sun Jul 25 08:42:28 2021 +++ src/tests/usr.bin/xlint/lint1/decl.exp Sun Jul 25 22:03:42 2021 @@ -12,3 +12,4 @@ decl.c(80): error: syntax error '"' [249 decl.c(163): error: syntax error 'int' [249] decl.c(166): error: syntax error 'int' [249] decl.c(114): warning: static function unused unused [236] +decl.c(170): warning: static function cover_func_declarator unused [236] Index: src/tests/usr.bin/xlint/lint1/parse_init_declarator.c diff -u src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.2 src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.3 --- src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.2 Sun Jul 25 17:40:04 2021 +++ src/tests/usr.bin/xlint/lint1/parse_init_declarator.c Sun Jul 25 22:03:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_init_declarator.c,v 1.2 2021/07/25 17:40:04 rillig Exp $ */ +/* $NetBSD: parse_init_declarator.c,v 1.3 2021/07/25 22:03:42 rillig Exp $ */ # 3 "parse_init_declarator.c" /* @@ -28,3 +28,6 @@ int *init_declarator_with_initializer_wr int *init_declarator_with_initializer_attribute_too_late __asm("") = _var
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 21:31:01 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: revert previous commit; it didn't improve readability No functional change. To generate a diff of this commit: cvs rdiff -u -r1.345 -r1.346 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.345 src/usr.bin/xlint/lint1/cgram.y:1.346 --- src/usr.bin/xlint/lint1/cgram.y:1.345 Sun Jul 25 19:57:22 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 21:31:01 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.345 2021/07/25 19:57:22 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.346 2021/07/25 21:31:01 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.345 2021/07/25 19:57:22 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.346 2021/07/25 21:31:01 rillig Exp $"); #endif #include @@ -337,9 +337,7 @@ anonymize(sym_t *s) %type identifier_list %type type_name %type abstract_declaration -%type abstract_declarator_opt %type abstract_declarator -%type direct_abstract_declarator_opt %type direct_abstract_declarator %type abstract_decl_param_list %type vararg_parameter_type_list @@ -1373,36 +1371,30 @@ type_name: /* C99 6.7.6 */ ; abstract_declaration: /* specific to lint */ - begin_type_qualifier_list end_type abstract_declarator_opt { - $$ = declare_1_abstract($3); + begin_type_qualifier_list end_type { + $$ = declare_1_abstract(abstract_name()); + } + | begin_type_specifier_qualifier_list end_type { + $$ = declare_1_abstract(abstract_name()); } - | begin_type_specifier_qualifier_list end_type - abstract_declarator_opt { + | begin_type_qualifier_list end_type abstract_declarator { $$ = declare_1_abstract($3); } - ; - -abstract_declarator_opt: - /* empty */ { - $$ = abstract_name(); + | begin_type_specifier_qualifier_list end_type abstract_declarator { + $$ = declare_1_abstract($3); } - | abstract_declarator ; /* K 8.7, C90 ???, C99 6.7.6, C11 6.7.7 */ /* In K, abstract-declarator could be empty and was still simpler. */ abstract_declarator: - pointer direct_abstract_declarator_opt { - $$ = add_pointer($2, $1); + pointer { + $$ = add_pointer(abstract_name(), $1); } | direct_abstract_declarator - ; - -direct_abstract_declarator_opt: - /* empty */ { - $$ = abstract_name(); + | pointer direct_abstract_declarator { + $$ = add_pointer($2, $1); } - | direct_abstract_declarator ; /* K ---, C90 ???, C99 6.7.6, C11 6.7.7 */
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 19:57:22 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: merge duplicate code for abstract_declaration No functional change; same code coverage outside of cgram.y. To generate a diff of this commit: cvs rdiff -u -r1.344 -r1.345 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.344 src/usr.bin/xlint/lint1/cgram.y:1.345 --- src/usr.bin/xlint/lint1/cgram.y:1.344 Sun Jul 25 19:27:26 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 19:57:22 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.344 2021/07/25 19:27:26 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.345 2021/07/25 19:57:22 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.344 2021/07/25 19:27:26 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.345 2021/07/25 19:57:22 rillig Exp $"); #endif #include @@ -337,7 +337,9 @@ anonymize(sym_t *s) %type identifier_list %type type_name %type abstract_declaration +%type abstract_declarator_opt %type abstract_declarator +%type direct_abstract_declarator_opt %type direct_abstract_declarator %type abstract_decl_param_list %type vararg_parameter_type_list @@ -1371,30 +1373,36 @@ type_name: /* C99 6.7.6 */ ; abstract_declaration: /* specific to lint */ - begin_type_qualifier_list end_type { - $$ = declare_1_abstract(abstract_name()); - } - | begin_type_specifier_qualifier_list end_type { - $$ = declare_1_abstract(abstract_name()); - } - | begin_type_qualifier_list end_type abstract_declarator { + begin_type_qualifier_list end_type abstract_declarator_opt { $$ = declare_1_abstract($3); } - | begin_type_specifier_qualifier_list end_type abstract_declarator { + | begin_type_specifier_qualifier_list end_type + abstract_declarator_opt { $$ = declare_1_abstract($3); } ; +abstract_declarator_opt: + /* empty */ { + $$ = abstract_name(); + } + | abstract_declarator + ; + /* K 8.7, C90 ???, C99 6.7.6, C11 6.7.7 */ /* In K, abstract-declarator could be empty and was still simpler. */ abstract_declarator: - pointer { - $$ = add_pointer(abstract_name(), $1); + pointer direct_abstract_declarator_opt { + $$ = add_pointer($2, $1); } | direct_abstract_declarator - | pointer direct_abstract_declarator { - $$ = add_pointer($2, $1); + ; + +direct_abstract_declarator_opt: + /* empty */ { + $$ = abstract_name(); } + | direct_abstract_declarator ; /* K ---, C90 ???, C99 6.7.6, C11 6.7.7 */
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 19:41:33 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: parse_type_name.c parse_type_name.exp Log Message: tests/lint: explain where the second __attribute__ comes from To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/parse_type_name.c \ src/tests/usr.bin/xlint/lint1/parse_type_name.exp 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/parse_type_name.c diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.5 src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.6 --- src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.5 Sun Jul 25 19:22:08 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sun Jul 25 19:41:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_type_name.c,v 1.5 2021/07/25 19:22:08 rillig Exp $ */ +/* $NetBSD: parse_type_name.c,v 1.6 2021/07/25 19:41:33 rillig Exp $ */ # 3 "parse_type_name.c" /* @@ -101,16 +101,15 @@ cover_abstract_decl_param_list(void) sink(sizeof(void (*)() __attribute__((; /* * XXX: The grammar allows only a single type_attribute_opt. - * Where does the second type_attribute go? + * All following __attribute__ come from direct_abstract_declarator. */ - sink(sizeof( - void (*)() __attribute__(()) __attribute__((; + sink(sizeof(void (*)() __attribute__(()) __attribute__((; /* cover 'abstract_decl_lparen vararg_parameter_type_list T_RPAREN type_attribute_opt' */ sink(sizeof(void (*)(void) __attribute__((; /* * XXX: The grammar allows only a single type_attribute_opt. - * Where does the second type_attribute go? + * All following __attribute__ come from direct_abstract_declarator. */ sink(sizeof(void (*)(void) __attribute__(()) __attribute__((; @@ -121,7 +120,7 @@ cover_abstract_decl_param_list(void) sink(sizeof(void (*)(goto) __attribute__((; /* * XXX: The grammar allows only a single type_attribute_opt. - * Where does the second type_attribute go? + * All following __attribute__ come from direct_abstract_declarator. */ /* expect+1: syntax error 'goto' [249] */ sink(sizeof(void (*)(goto) __attribute__(()) __attribute__((; Index: src/tests/usr.bin/xlint/lint1/parse_type_name.exp diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.5 src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.6 --- src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.5 Sun Jul 25 19:22:08 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.exp Sun Jul 25 19:41:33 2021 @@ -1,7 +1,7 @@ parse_type_name.c(52): error: cannot take size/alignment of function [144] parse_type_name.c(72): error: null dimension [17] parse_type_name.c(76): error: null dimension [17] -parse_type_name.c(119): error: syntax error 'goto' [249] -parse_type_name.c(121): error: syntax error 'goto' [249] -parse_type_name.c(127): error: syntax error 'goto' [249] -parse_type_name.c(141): warning: ANSI C requires formal parameter before '...' [84] +parse_type_name.c(118): error: syntax error 'goto' [249] +parse_type_name.c(120): error: syntax error 'goto' [249] +parse_type_name.c(126): error: syntax error 'goto' [249] +parse_type_name.c(140): warning: ANSI C requires formal parameter before '...' [84]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 19:27:26 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: resolve conflicts in begin_type_specifier_qualifier_list The 9 shift/reduce conflicts were all internal to the grammar rule begin_type_specifier_qualifier_list. Previously, there were two possible ways to parse '__attribute__(()) const int': 1. '__attribute__(())' 'const int' 2. '__attribute__(()) const' 'int' Both ways would produce the same result since __attribute__ has almost no observable effects on the resulting type. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.343 -r1.344 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.343 src/usr.bin/xlint/lint1/cgram.y:1.344 --- src/usr.bin/xlint/lint1/cgram.y:1.343 Sun Jul 25 19:05:27 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 19:27:26 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.343 2021/07/25 19:05:27 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.344 2021/07/25 19:27:26 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.343 2021/07/25 19:05:27 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.344 2021/07/25 19:27:26 rillig Exp $"); #endif #include @@ -124,7 +124,7 @@ anonymize(sym_t *s) %} -%expect 159 +%expect 150 %union { val_t *y_val; @@ -778,21 +778,24 @@ begin_type_declmods: /* see C99 6.7 */ ; begin_type_specifier_qualifier_list: /* see C11 6.7.2.1 */ + begin_type_specifier_qualifier_list_postfix + | type_attribute_list begin_type_specifier_qualifier_list_postfix + ; + +begin_type_specifier_qualifier_list_postfix: begin_type_typespec { add_type($1); } - /* TODO: shift/reduce conflict for type_attribute */ - | type_attribute begin_type_specifier_qualifier_list | begin_type_qualifier_list type_specifier { add_type($2); } - | begin_type_specifier_qualifier_list T_QUAL { + | begin_type_specifier_qualifier_list_postfix T_QUAL { add_qualifier($2); } - | begin_type_specifier_qualifier_list notype_type_specifier { + | begin_type_specifier_qualifier_list_postfix notype_type_specifier { add_type($2); } - | begin_type_specifier_qualifier_list type_attribute + | begin_type_specifier_qualifier_list_postfix type_attribute ; begin_type_typespec:
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 19:22:08 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: parse_type_name.c parse_type_name.exp Log Message: tests/lint: fix unintended line breaks To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/parse_type_name.c \ src/tests/usr.bin/xlint/lint1/parse_type_name.exp 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/parse_type_name.c diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.4 src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.5 --- src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.4 Sun Jul 25 15:48:58 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sun Jul 25 19:22:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_type_name.c,v 1.4 2021/07/25 15:48:58 rillig Exp $ */ +/* $NetBSD: parse_type_name.c,v 1.5 2021/07/25 19:22:08 rillig Exp $ */ # 3 "parse_type_name.c" /* @@ -80,29 +80,17 @@ cover_direct_abstract_declarator(void) /* cover 'abstract_decl_param_list asm_or_symbolrename_opt' */ sink(sizeof(int(double))); - sink(sizeof( - int( - double) __asm("anything"))); - sink(sizeof( - int( - double) __symbolrename(alias))); + sink(sizeof(int(double) __asm("anything"))); + sink(sizeof(int(double) __symbolrename(alias))); /* cover 'direct_abstract_declarator abstract_decl_param_list asm_or_symbolrename_opt' */ sink(sizeof(int (*)(double))); - sink(sizeof( - int(*)(double) __asm("anything"))); - sink(sizeof( - int(*) - (double)__symbolrename(alias))); + sink(sizeof(int (*)(double) __asm("anything"))); + sink(sizeof(int (*)(double)__symbolrename(alias))); /* cover 'direct_abstract_declarator type_attribute_list' */ - sink(sizeof( - int(*) - __attribute__((; - sink(sizeof( - int(*) - __attribute__(()) - __attribute__((; + sink(sizeof(int (*) __attribute__((; + sink(sizeof(int (*) __attribute__(()) __attribute__((; } void @@ -110,32 +98,21 @@ cover_abstract_decl_param_list(void) { /* cover 'abstract_decl_lparen T_RPAREN type_attribute_opt' */ sink(sizeof(void (*)())); - sink(sizeof( - void (*) - () - __attribute__((; + sink(sizeof(void (*)() __attribute__((; /* * XXX: The grammar allows only a single type_attribute_opt. * Where does the second type_attribute go? */ sink(sizeof( - void (*) - () - __attribute__(()) - __attribute__((; + void (*)() __attribute__(()) __attribute__((; /* cover 'abstract_decl_lparen vararg_parameter_type_list T_RPAREN type_attribute_opt' */ - sink(sizeof( - void (*) - (void)__attribute__((; + sink(sizeof(void (*)(void) __attribute__((; /* * XXX: The grammar allows only a single type_attribute_opt. * Where does the second type_attribute go? */ - sink(sizeof( - void (*) - (void)__attribute__(()) - __attribute__((; + sink(sizeof(void (*)(void) __attribute__(()) __attribute__((; /* cover 'abstract_decl_lparen error T_RPAREN type_attribute_opt' */ /* expect+1: syntax error 'goto' [249] */ @@ -193,8 +170,7 @@ cover_parameter_declaration(void) /* cover 'begin_type_declmods end_type abstract_declarator' */ /* GCC 11 warns: type defaults to 'int' in type name */ - sink(sizeof( - void (*)(int, const *))); + sink(sizeof(void (*)(int, const *))); /* cover 'begin_type_declaration_specifiers end_type abstract_declarator' */ sink(sizeof(void (*)(int, double *))); Index: src/tests/usr.bin/xlint/lint1/parse_type_name.exp diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.4 src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.5 --- src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.4 Sun Jul 25 15:48:58 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.exp Sun Jul 25 19:22:08 2021 @@ -1,7 +1,7 @@ parse_type_name.c(52): error: cannot take size/alignment of function [144] parse_type_name.c(72): error: null dimension [17] parse_type_name.c(76): error: null dimension [17] -parse_type_name.c(142): error: syntax error 'goto' [249] -parse_type_name.c(144): error: syntax error 'goto' [249] -parse_type_name.c(150): error: syntax error 'goto' [249] -parse_type_name.c(164): warning: ANSI C requires formal parameter before '...' [84] +parse_type_name.c(119): error: syntax error 'goto' [249] +parse_type_name.c(121): error: syntax error 'goto' [249] +parse_type_name.c(127): error: syntax error 'goto' [249] +parse_type_name.c(141): warning: ANSI C requires formal parameter before '...' [84]
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 19:05:27 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_attribute_type.c gcc_attribute_type.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: reorder grammar rules First the base cases, then the extensions, like in most other rules in this file. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_type.c \ src/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp cvs rdiff -u -r1.342 -r1.343 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/gcc_attribute_type.c diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_type.c:1.1 src/tests/usr.bin/xlint/lint1/gcc_attribute_type.c:1.2 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_type.c:1.1 Tue Jul 6 17:33:07 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_type.c Sun Jul 25 19:05:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_attribute_type.c,v 1.1 2021/07/06 17:33:07 rillig Exp $ */ +/* $NetBSD: gcc_attribute_type.c,v 1.2 2021/07/25 19:05:27 rillig Exp $ */ # 3 "gcc_attribute_type.c" /* @@ -7,6 +7,8 @@ * https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html */ +struct __attribute__((__packed__)) __attribute__(()) packed_record; + struct __attribute__((__packed__)) packed_record { unsigned char len[2]; unsigned long magic; Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp:1.1 src/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp:1.2 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp:1.1 Tue Jul 6 17:33:07 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_type.exp Sun Jul 25 19:05:27 2021 @@ -1 +1 @@ -gcc_attribute_type.c(29): error: syntax error 'syntax_error' [249] +gcc_attribute_type.c(31): error: syntax error 'syntax_error' [249] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.342 src/usr.bin/xlint/lint1/cgram.y:1.343 --- src/usr.bin/xlint/lint1/cgram.y:1.342 Sun Jul 25 18:48:47 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 19:05:27 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.342 2021/07/25 18:48:47 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.343 2021/07/25 19:05:27 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.342 2021/07/25 18:48:47 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.343 2021/07/25 19:05:27 rillig Exp $"); #endif #include @@ -650,7 +650,8 @@ expression_opt: /* 'conditional_expression' also implements 'logical_OR_expression'. */ /* K ???, C90 ???, C99 6.5.5 to 6.5.15, C11 6.5.5 to 6.5.15 */ conditional_expression: - conditional_expression T_ASTERISK conditional_expression { + cast_expression + | conditional_expression T_ASTERISK conditional_expression { $$ = build_binary($1, MULT, $3); } | conditional_expression T_MULTIPLICATIVE conditional_expression { @@ -687,7 +688,7 @@ conditional_expression: T_COLON conditional_expression { $$ = build_binary($1, QUEST, build_binary($3, COLON, $5)); } - | cast_expression; + ; /* K ???, C90 ???, C99 6.5.16, C11 6.5.16 */ assignment_expression: @@ -911,14 +912,14 @@ struct_or_union_specifier: /* C99 6.7.2. ; struct_or_union: /* C99 6.7.2.1 */ - struct_or_union type_attribute - | T_STRUCT_OR_UNION { + T_STRUCT_OR_UNION { symtyp = FTAG; begin_declaration_level($1 == STRUCT ? MOS : MOU); dcs->d_offset = 0; dcs->d_sou_align_in_bits = CHAR_SIZE; $$ = $1; } + | struct_or_union type_attribute ; braced_struct_declaration_list: /* see C99 6.7.2.1 */
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 18:48:47 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_attribute_enum.c gcc_attribute_enum.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: fix parsing of enumerators with __attribute__ To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c \ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp cvs rdiff -u -r1.341 -r1.342 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/gcc_attribute_enum.c diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.4 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.3 Sun Jul 25 18:44:21 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c Sun Jul 25 18:48:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_attribute_enum.c,v 1.3 2021/07/25 18:44:21 rillig Exp $ */ +/* $NetBSD: gcc_attribute_enum.c,v 1.4 2021/07/25 18:48:47 rillig Exp $ */ # 3 "gcc_attribute_enum.c" /* @@ -30,15 +30,15 @@ enum __attribute__(()) { */ enum without_initializer { - /* expect+1: error: syntax error '__attribute__' [249] */ NO_INIT_FIRST __attribute__(()), - NO_INIT__LAST __attribute__(()) + NO_INIT_LAST __attribute__(()) }; enum with_initializer { - /* expect+1: error: syntax error '__attribute__' [249] */ INIT_FIRST __attribute__(()) = 1, - INIT__LAST __attribute__(()) = 2 + INIT_LAST __attribute__(()) = 2, + /* expect+1: syntax error '__attribute__' [249] */ + INIT_WRONG = 3 __attribute__(()), }; enum tag { Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.4 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.3 Sun Jul 25 18:44:21 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp Sun Jul 25 18:48:47 2021 @@ -1,2 +1 @@ -gcc_attribute_enum.c(34): error: syntax error '__attribute__' [249] -gcc_attribute_enum.c(40): error: syntax error '__attribute__' [249] +gcc_attribute_enum.c(41): error: syntax error '__attribute__' [249] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.341 src/usr.bin/xlint/lint1/cgram.y:1.342 --- src/usr.bin/xlint/lint1/cgram.y:1.341 Sun Jul 25 18:44:21 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 18:48:47 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.341 2021/07/25 18:44:21 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.342 2021/07/25 18:48:47 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.341 2021/07/25 18:44:21 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.342 2021/07/25 18:48:47 rillig Exp $"); #endif #include @@ -1101,11 +1101,11 @@ enumerator_list: /* C99 6.7.2.2 */ ; enumerator: /* C99 6.7.2.2 */ - identifier_sym { + identifier_sym gcc_attribute_list_opt { $$ = enumeration_constant($1, enumval, true); } - | identifier_sym T_ASSIGN constant_expr { - $$ = enumeration_constant($1, to_int_constant($3, true), + | identifier_sym gcc_attribute_list_opt T_ASSIGN constant_expr { + $$ = enumeration_constant($1, to_int_constant($4, true), false); } ;
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 18:44:21 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_attribute_enum.c gcc_attribute_enum.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: fix parsing of __attribute__ before enum tag The __attribute__ after the enumerators will be fixed in a follow-up commit since lint exits after the 5th syntax error in a translation unit, which up to now shadowed the error messages about the enumerators. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c \ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp cvs rdiff -u -r1.340 -r1.341 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/gcc_attribute_enum.c diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.3 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.2 Sun Jul 25 18:34:44 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c Sun Jul 25 18:44:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_attribute_enum.c,v 1.2 2021/07/25 18:34:44 rillig Exp $ */ +/* $NetBSD: gcc_attribute_enum.c,v 1.3 2021/07/25 18:44:21 rillig Exp $ */ # 3 "gcc_attribute_enum.c" /* @@ -13,22 +13,15 @@ * See GCC, c-parser.c, function c_parser_enum_specifier. */ -/* expect+1: syntax error '__attribute__' [249] */ enum __attribute__(()) tag; -/* expect+2: syntax error '__attribute__' [249] */ -/* expect+1: syntax error '{' [249] */ enum __attribute__(()) tag_with_declaration { TAG_WITH_DECL } __attribute__(()); -/* expect-1: syntax error ';' [249] */ -/* expect+1: syntax error '{' [249] */ enum __attribute__(()) { ONLY_DECL } __attribute__(()); -/* expect-1: syntax error ';' [249] */ -/* expect-2: error: cannot recover from previous errors [224] */ /* * Attributes in enumerator. @@ -36,12 +29,18 @@ enum __attribute__(()) { * See GCC, c-parser.c, function c_parser_enum_specifier. */ -enum { +enum without_initializer { + /* expect+1: error: syntax error '__attribute__' [249] */ NO_INIT_FIRST __attribute__(()), NO_INIT__LAST __attribute__(()) }; -enum { +enum with_initializer { + /* expect+1: error: syntax error '__attribute__' [249] */ INIT_FIRST __attribute__(()) = 1, INIT__LAST __attribute__(()) = 2 }; + +enum tag { + TAG +}; Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.3 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.2 Sun Jul 25 18:34:44 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp Sun Jul 25 18:44:21 2021 @@ -1,7 +1,2 @@ -gcc_attribute_enum.c(17): error: syntax error '__attribute__' [249] -gcc_attribute_enum.c(21): error: syntax error '__attribute__' [249] -gcc_attribute_enum.c(21): error: syntax error '{' [249] -gcc_attribute_enum.c(23): error: syntax error ';' [249] -gcc_attribute_enum.c(27): error: syntax error '{' [249] -gcc_attribute_enum.c(29): error: syntax error ';' [249] -gcc_attribute_enum.c(29): error: cannot recover from previous errors [224] +gcc_attribute_enum.c(34): error: syntax error '__attribute__' [249] +gcc_attribute_enum.c(40): error: syntax error '__attribute__' [249] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.340 src/usr.bin/xlint/lint1/cgram.y:1.341 --- src/usr.bin/xlint/lint1/cgram.y:1.340 Sun Jul 25 18:01:03 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 18:44:21 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.340 2021/07/25 18:01:03 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.341 2021/07/25 18:44:21 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.340 2021/07/25 18:01:03 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.341 2021/07/25 18:44:21 rillig Exp $"); #endif #include @@ -1037,18 +1037,18 @@ type_struct_declarator: ; enum_specifier: /* C99 6.7.2.2 */ - enum identifier_sym { - $$ = mktag($2, ENUM, false, false); + enum gcc_attribute_list_opt identifier_sym { + $$ = mktag($3, ENUM, false, false); } - | enum identifier_sym { - dcs->d_tagtyp = mktag($2, ENUM, true, false); - } enum_declaration { - $$ = complete_tag_enum(dcs->d_tagtyp, $4); + | enum gcc_attribute_list_opt identifier_sym { + dcs->d_tagtyp = mktag($3, ENUM, true, false); + } enum_declaration /*gcc_attribute_list_opt*/ { + $$ = complete_tag_enum(dcs->d_tagtyp, $5); } - | enum { + | enum gcc_attribute_list_opt { dcs->d_tagtyp = mktag(NULL, ENUM, true, false); - } enum_declaration { - $$ = complete_tag_enum(dcs->d_tagtyp, $3); + } enum_declaration
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 18:34:44 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_attribute_enum.c gcc_attribute_enum.exp Log Message: tests/lint: test __attribute__ with enum To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c \ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp 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/gcc_attribute_enum.c diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.1 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.2 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c:1.1 Tue Jul 6 17:33:07 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.c Sun Jul 25 18:34:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_attribute_enum.c,v 1.1 2021/07/06 17:33:07 rillig Exp $ */ +/* $NetBSD: gcc_attribute_enum.c,v 1.2 2021/07/25 18:34:44 rillig Exp $ */ # 3 "gcc_attribute_enum.c" /* @@ -7,16 +7,41 @@ * https://gcc.gnu.org/onlinedocs/gcc/Enumerator-Attributes.html */ -enum Planet { - Mercury, - Venus, - Earth, - Mars, - Jupiter, - Saturn, - Uranus, - Neptune, - /* https://en.wikipedia.org/wiki/Pluto_(planet) */ - /*FIXME*//* expect+1: error: syntax error '__attribute__' [249] */ - Pluto __attribute__((__deprecated__ /* since August 2006 */)) +/* + * Attributes in enum-specifier. + * + * See GCC, c-parser.c, function c_parser_enum_specifier. + */ + +/* expect+1: syntax error '__attribute__' [249] */ +enum __attribute__(()) tag; + +/* expect+2: syntax error '__attribute__' [249] */ +/* expect+1: syntax error '{' [249] */ +enum __attribute__(()) tag_with_declaration { + TAG_WITH_DECL +} __attribute__(()); +/* expect-1: syntax error ';' [249] */ + +/* expect+1: syntax error '{' [249] */ +enum __attribute__(()) { + ONLY_DECL +} __attribute__(()); +/* expect-1: syntax error ';' [249] */ +/* expect-2: error: cannot recover from previous errors [224] */ + +/* + * Attributes in enumerator. + * + * See GCC, c-parser.c, function c_parser_enum_specifier. + */ + +enum { + NO_INIT_FIRST __attribute__(()), + NO_INIT__LAST __attribute__(()) +}; + +enum { + INIT_FIRST __attribute__(()) = 1, + INIT__LAST __attribute__(()) = 2 }; Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.1 src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.2 --- src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp:1.1 Tue Jul 6 17:33:07 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute_enum.exp Sun Jul 25 18:34:44 2021 @@ -1 +1,7 @@ +gcc_attribute_enum.c(17): error: syntax error '__attribute__' [249] gcc_attribute_enum.c(21): error: syntax error '__attribute__' [249] +gcc_attribute_enum.c(21): error: syntax error '{' [249] +gcc_attribute_enum.c(23): error: syntax error ';' [249] +gcc_attribute_enum.c(27): error: syntax error '{' [249] +gcc_attribute_enum.c(29): error: syntax error ';' [249] +gcc_attribute_enum.c(29): error: cannot recover from previous errors [224]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 18:01:03 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: add citations for a few grammar rules No functional change. To generate a diff of this commit: cvs rdiff -u -r1.339 -r1.340 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.339 src/usr.bin/xlint/lint1/cgram.y:1.340 --- src/usr.bin/xlint/lint1/cgram.y:1.339 Sun Jul 25 17:40:04 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 18:01:03 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.339 2021/07/25 17:40:04 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.340 2021/07/25 18:01:03 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.339 2021/07/25 17:40:04 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.340 2021/07/25 18:01:03 rillig Exp $"); #endif #include @@ -1366,7 +1366,7 @@ type_name: /* C99 6.7.6 */ } ; -abstract_declaration: +abstract_declaration: /* specific to lint */ begin_type_qualifier_list end_type { $$ = declare_1_abstract(abstract_name()); } @@ -1381,7 +1381,9 @@ abstract_declaration: } ; -abstract_declarator: /* C99 6.7.6 */ +/* K 8.7, C90 ???, C99 6.7.6, C11 6.7.7 */ +/* In K, abstract-declarator could be empty and was still simpler. */ +abstract_declarator: pointer { $$ = add_pointer(abstract_name(), $1); } @@ -1391,7 +1393,8 @@ abstract_declarator: /* C99 6.7.6 */ } ; -direct_abstract_declarator: /* C99 6.7.6 */ +/* K ---, C90 ???, C99 6.7.6, C11 6.7.7 */ +direct_abstract_declarator: T_LPAREN abstract_declarator T_RPAREN { $$ = $2; } @@ -1428,7 +1431,7 @@ direct_abstract_declarator: /* C99 6.7.6 | direct_abstract_declarator type_attribute_list ; -abstract_decl_param_list: +abstract_decl_param_list: /* specific to lint */ abstract_decl_lparen T_RPAREN type_attribute_opt { $$ = NULL; } @@ -1442,14 +1445,14 @@ abstract_decl_param_list: } ; -abstract_decl_lparen: +abstract_decl_lparen: /* specific to lint */ T_LPAREN { block_level++; begin_declaration_level(PROTO_ARG); } ; -vararg_parameter_type_list: +vararg_parameter_type_list: /* specific to lint */ parameter_type_list | parameter_type_list T_COMMA T_ELLIPSIS { dcs->d_vararg = true;
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 17:40:04 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: parse_init_declarator.c parse_init_declarator.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: fix parsing of GNU __attribute__ after __asm GCC only accepts them in the order __asm __attribute__, not the other way round. So should lint. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 \ src/tests/usr.bin/xlint/lint1/parse_init_declarator.c \ src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp cvs rdiff -u -r1.338 -r1.339 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/parse_init_declarator.c diff -u src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.1 src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.2 --- src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.1 Sun Jul 25 17:27:07 2021 +++ src/tests/usr.bin/xlint/lint1/parse_init_declarator.c Sun Jul 25 17:40:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_init_declarator.c,v 1.1 2021/07/25 17:27:07 rillig Exp $ */ +/* $NetBSD: parse_init_declarator.c,v 1.2 2021/07/25 17:40:04 rillig Exp $ */ # 3 "parse_init_declarator.c" /* @@ -12,8 +12,6 @@ int global_var; int *init_declarator_without_initializer __asm("") __attribute__((deprecated)); -/* expect-1: error: syntax error '__attribute__' [249] */ -/* FIXME */ /* XXX: GCC does not accept this, neither should lint. */ int *init_declarator_without_initializer_wrong_order @@ -21,8 +19,6 @@ int *init_declarator_without_initializer int *init_declarator_with_initializer __asm("") __attribute__((deprecated)) = _var; -/* expect-1: error: syntax error '__attribute__' [249] */ -/* FIXME */ /* XXX: GCC does not accept this, neither should lint. */ int *init_declarator_with_initializer_wrong_order Index: src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp diff -u src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp:1.1 src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp:1.2 --- src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp:1.1 Sun Jul 25 17:27:07 2021 +++ src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp Sun Jul 25 17:40:04 2021 @@ -1,3 +1 @@ -parse_init_declarator.c(14): error: syntax error '__attribute__' [249] -parse_init_declarator.c(23): error: syntax error '__attribute__' [249] -parse_init_declarator.c(33): error: syntax error '__attribute__' [249] +parse_init_declarator.c(29): error: syntax error '__attribute__' [249] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.338 src/usr.bin/xlint/lint1/cgram.y:1.339 --- src/usr.bin/xlint/lint1/cgram.y:1.338 Sun Jul 25 16:57:23 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 17:40:04 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.338 2021/07/25 16:57:23 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.339 2021/07/25 17:40:04 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.338 2021/07/25 16:57:23 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.339 2021/07/25 17:40:04 rillig Exp $"); #endif #include @@ -124,7 +124,7 @@ anonymize(sym_t *s) %} -%expect 156 +%expect 159 %union { val_t *y_val; @@ -833,11 +833,7 @@ type_attribute_opt: ; type_attribute: /* See C11 6.7 declaration-specifiers */ - T_ATTRIBUTE T_LPAREN T_LPAREN { - attron = true; - } gcc_attribute_spec_list { - attron = false; - } T_RPAREN T_RPAREN + gcc_attribute /* TODO: c11ism */ | T_ALIGNAS T_LPAREN align_as T_RPAREN | T_PACKED { @@ -1592,11 +1588,11 @@ asm_or_symbolrename_opt: /* GCC extensio /* empty */ { $$ = NULL; } - | T_ASM T_LPAREN T_STRING T_RPAREN { + | T_ASM T_LPAREN T_STRING T_RPAREN gcc_attribute_list_opt { freeyyv(&$3, T_STRING); $$ = NULL; } - | T_SYMBOLRENAME T_LPAREN T_NAME T_RPAREN { + | T_SYMBOLRENAME T_LPAREN T_NAME T_RPAREN gcc_attribute_list_opt { $$ = $3; } ; @@ -2006,6 +2002,24 @@ arg_declaration: | begin_type_declaration_specifiers error ; +gcc_attribute_list_opt: + /* empty */ + | gcc_attribute_list + ; + +gcc_attribute_list: + gcc_attribute + | gcc_attribute_list gcc_attribute + ; + +gcc_attribute: + T_ATTRIBUTE T_LPAREN T_LPAREN { + attron = true; + } gcc_attribute_spec_list { + attron = false; + } T_RPAREN T_RPAREN + ; + gcc_attribute_spec_list: gcc_attribute_spec | gcc_attribute_spec_list T_COMMA gcc_attribute_spec
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 17:27:07 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile Added Files: src/tests/usr.bin/xlint/lint1: parse_init_declarator.c parse_init_declarator.exp Log Message: tests/lint: test declarators with attributes To generate a diff of this commit: cvs rdiff -u -r1.1094 -r1.1095 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.95 -r1.96 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/parse_init_declarator.c \ src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1094 src/distrib/sets/lists/tests/mi:1.1095 --- src/distrib/sets/lists/tests/mi:1.1094 Sun Jul 25 10:57:38 2021 +++ src/distrib/sets/lists/tests/mi Sun Jul 25 17:27:07 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1094 2021/07/25 10:57:38 rillig Exp $ +# $NetBSD: mi,v 1.1095 2021/07/25 17:27:07 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6992,6 +6992,8 @@ ./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_init_declarator.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_init_declarator.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_stmt_error.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_stmt_error.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.95 src/tests/usr.bin/xlint/lint1/Makefile:1.96 --- src/tests/usr.bin/xlint/lint1/Makefile:1.95 Sun Jul 25 10:57:38 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jul 25 17:27:07 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.95 2021/07/25 10:57:38 rillig Exp $ +# $NetBSD: Makefile,v 1.96 2021/07/25 17:27:07 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -198,6 +198,8 @@ FILES+= op_colon.c FILES+= op_colon.exp FILES+= op_shl_lp64.c FILES+= op_shl_lp64.exp +FILES+= parse_init_declarator.c +FILES+= parse_init_declarator.exp FILES+= parse_stmt_error.c FILES+= parse_stmt_error.exp FILES+= parse_stmt_iter_error.c Added files: Index: src/tests/usr.bin/xlint/lint1/parse_init_declarator.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/parse_init_declarator.c:1.1 --- /dev/null Sun Jul 25 17:27:07 2021 +++ src/tests/usr.bin/xlint/lint1/parse_init_declarator.c Sun Jul 25 17:27:07 2021 @@ -0,0 +1,34 @@ +/* $NetBSD: parse_init_declarator.c,v 1.1 2021/07/25 17:27:07 rillig Exp $ */ +# 3 "parse_init_declarator.c" + +/* + * Test parsing of init-declarator, which occurs as part of a top-level + * declaration. + * + * See also: GCC, c-parser.cpp, function c_parser_declaration_or_fndef. + */ + +int global_var; + +int *init_declarator_without_initializer +__asm("") __attribute__((deprecated)); +/* expect-1: error: syntax error '__attribute__' [249] */ +/* FIXME */ + +/* XXX: GCC does not accept this, neither should lint. */ +int *init_declarator_without_initializer_wrong_order +__attribute__((deprecated)) __asm(""); + +int *init_declarator_with_initializer +__asm("") __attribute__((deprecated)) = _var; +/* expect-1: error: syntax error '__attribute__' [249] */ +/* FIXME */ + +/* XXX: GCC does not accept this, neither should lint. */ +int *init_declarator_with_initializer_wrong_order +__attribute__((deprecated)) __asm("") = _var; + +/* The attributes may only occur before the initializer, not after it. */ +int *init_declarator_with_initializer_attribute_too_late +__asm("") = _var __attribute__((deprecated)); +/* expect-1: error: syntax error '__attribute__' [249] */ Index: src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp:1.1 --- /dev/null Sun Jul 25 17:27:07 2021 +++ src/tests/usr.bin/xlint/lint1/parse_init_declarator.exp Sun Jul 25 17:27:07 2021 @@ -0,0 +1,3 @@ +parse_init_declarator.c(14): error: syntax error '__attribute__' [249] +parse_init_declarator.c(23): error: syntax error '__attribute__' [249] +parse_init_declarator.c(33): error: syntax error '__attribute__' [249]
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 16:57:23 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: wrap overly long lines No functional change. To generate a diff of this commit: cvs rdiff -u -r1.337 -r1.338 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.337 src/usr.bin/xlint/lint1/cgram.y:1.338 --- src/usr.bin/xlint/lint1/cgram.y:1.337 Sun Jul 25 15:58:24 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 16:57:23 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.337 2021/07/25 15:58:24 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.338 2021/07/25 16:57:23 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.337 2021/07/25 15:58:24 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.338 2021/07/25 16:57:23 rillig Exp $"); #endif #include @@ -608,7 +608,8 @@ unary_expression: | T_SIZEOF unary_expression { $$ = $2 == NULL ? NULL : build_sizeof($2->tn_type); if ($$ != NULL) - check_expr_misc($2, false, false, false, false, false, true); + check_expr_misc($2, + false, false, false, false, false, true); } | T_SIZEOF T_LPAREN type_name T_RPAREN { $$ = build_sizeof($3); @@ -971,7 +972,8 @@ struct_declaration: /* C99 6.7.2.1 */ error(249, "member without type"); $$ = NULL; } - | begin_type_specifier_qualifier_list end_type type_attribute_opt T_SEMI { + | begin_type_specifier_qualifier_list end_type type_attribute_opt + T_SEMI { symtyp = FVFT; if (!Sflag) /* anonymous struct/union members is a C9X feature */ @@ -1016,7 +1018,7 @@ type_struct_declarators: notype_struct_declarator: notype_declarator - | notype_declarator T_COLON constant_expr { /* C99 6.7.2.1 */ + | notype_declarator T_COLON constant_expr { /* C99 6.7.2.1 */ $$ = bitfield($1, to_int_constant($3, true)); } | { @@ -1107,7 +1109,8 @@ enumerator: /* C99 6.7.2.2 */ $$ = enumeration_constant($1, enumval, true); } | identifier_sym T_ASSIGN constant_expr { - $$ = enumeration_constant($1, to_int_constant($3, true), false); + $$ = enumeration_constant($1, to_int_constant($3, true), + false); } ; @@ -1258,9 +1261,9 @@ type_direct_declarator: ; /* - * The two distinct rules type_param_declarator and notype_param_declarator avoid a - * conflict in argument lists. A typename enclosed in parentheses is always - * treated as a typename, not an argument name. For example, after + * The two distinct rules type_param_declarator and notype_param_declarator + * avoid a conflict in argument lists. A typename enclosed in parentheses is + * always treated as a typename, not an argument name. For example, after * "typedef double a;", the declaration "f(int (a));" is interpreted as * "f(int (double));", not "f(int a);". */ @@ -1400,7 +1403,8 @@ direct_abstract_declarator: /* C99 6.7.6 $$ = add_array(abstract_name(), false, 0); } | T_LBRACK array_size T_RBRACK { - $$ = add_array(abstract_name(), true, to_int_constant($2, false)); + $$ = add_array(abstract_name(), true, + to_int_constant($2, false)); } | type_attribute direct_abstract_declarator { $$ = $2; @@ -1419,7 +1423,8 @@ direct_abstract_declarator: /* C99 6.7.6 end_declaration_level(); block_level--; } - | direct_abstract_declarator 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--; @@ -1431,7 +1436,8 @@ abstract_decl_param_list: abstract_decl_lparen T_RPAREN type_attribute_opt { $$ = NULL; } - | abstract_decl_lparen vararg_parameter_type_list T_RPAREN type_attribute_opt { + | abstract_decl_lparen vararg_parameter_type_list T_RPAREN + type_attribute_opt { dcs->d_proto = true; $$ = $2; }
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 15:58:24 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_typeof.c gcc_typeof.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: do not parse 'typeof(0)(void)' as function call Previously, lint tried to parse 'typeof(0)(void)' as 'typeof' '(0)(void)', which tries to call 0 as a function. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/gcc_typeof.c \ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp cvs rdiff -u -r1.336 -r1.337 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/gcc_typeof.c diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.2 src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.3 --- src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.2 Sun Jul 25 11:19:51 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.c Sun Jul 25 15:58:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_typeof.c,v 1.2 2021/07/25 11:19:51 rillig Exp $ */ +/* $NetBSD: gcc_typeof.c,v 1.3 2021/07/25 15:58:24 rillig Exp $ */ # 3 "gcc_typeof.c" /* @@ -10,16 +10,7 @@ void take_double(typeof(0.0)); void take_function_double_returning_double( -/* - * FIXME: lint's grammar uses 'typeof cast_expression', while GCC's - * c_parser_typeof_specifier uses 'typeof ( expression )'. The crucial - * difference is that lint parses the following expression as 'typeof - * ((0.0)(typeof(0.0))', that is, it tries to call the function 0.0, - * which of course is nonsense. - */ typeof(0.0)( - /* FIXME: GCC can parse this */ - /* expect+1: error: syntax error 'typeof' [249] */ typeof(0.0) ) ); @@ -32,7 +23,7 @@ cast(double(*fn)(double)) /* expect+1: warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155] */ take_double(fn); - /* XXX: oops; GCC detects this type mismatch. probably due to the parse error. */ + /* expect+1: warning: passing 'double' to incompatible 'pointer to function(double) returning double', arg #1 [155] */ take_function_double_returning_double(0.0); take_function_double_returning_double(fn); Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.exp diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.2 src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.3 --- src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.2 Sun Jul 25 11:19:51 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp Sun Jul 25 15:58:24 2021 @@ -1,2 +1,2 @@ -gcc_typeof.c(23): error: syntax error 'typeof' [249] -gcc_typeof.c(33): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155] +gcc_typeof.c(24): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155] +gcc_typeof.c(27): warning: passing 'double' to incompatible 'pointer to function(double) returning double', arg #1 [155] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.336 src/usr.bin/xlint/lint1/cgram.y:1.337 --- src/usr.bin/xlint/lint1/cgram.y:1.336 Sun Jul 25 15:48:57 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 15:58:24 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.336 2021/07/25 15:48:57 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.337 2021/07/25 15:58:24 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.336 2021/07/25 15:48:57 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.337 2021/07/25 15:58:24 rillig Exp $"); #endif #include @@ -124,7 +124,7 @@ anonymize(sym_t *s) %} -%expect 158 +%expect 156 %union { val_t *y_val; @@ -873,8 +873,8 @@ notype_type_specifier: /* see C99 6.7.2 T_TYPE { $$ = gettyp($1); } - | T_TYPEOF cast_expression { /* GCC extension */ - $$ = $2->tn_type; + | T_TYPEOF T_LPAREN expression T_RPAREN { /* GCC extension */ + $$ = $3->tn_type; } | struct_or_union_specifier { end_declaration_level();
CVS commit: src/tests/usr.sbin/execsnoop
Module Name:src Committed By: gson Date: Sun Jul 25 15:51:32 UTC 2021 Modified Files: src/tests/usr.sbin/execsnoop: t_execsnoop.sh Log Message: Only expect failure on ARM To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.sbin/execsnoop/t_execsnoop.sh 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.sbin/execsnoop/t_execsnoop.sh diff -u src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.7 src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.8 --- src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.7 Sun Jul 25 10:21:44 2021 +++ src/tests/usr.sbin/execsnoop/t_execsnoop.sh Sun Jul 25 15:51:32 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_execsnoop.sh,v 1.7 2021/07/25 10:21:44 gson Exp $ +# $NetBSD: t_execsnoop.sh,v 1.8 2021/07/25 15:51:32 gson Exp $ # # Copyright (c) 2020 The NetBSD Foundation, Inc. # All rights reserved. @@ -37,7 +37,10 @@ basic_head() { } basic_body() { - atf_expect_fail "PR kern/53417" + case `uname -p` in + *arm*) + atf_expect_fail "PR kern/53417" ;; + esac n=10 atf_check -s exit:0 -o ignore -e empty -x "execsnoop > $tmp &"
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 15:48:58 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: parse_type_name.c parse_type_name.exp src/usr.bin/xlint/lint1: cgram.y Log Message: lint: fix parsing of 'typeof(double(typeof(0.0)))' By removing the misplaced grammar rule 'abstract_declarator: T_TYPEOF', the type expression 'typeof(double(typeof(0.0)))' is no longer interpreted as a declarator, but rather as a type specifier, just as in the GCC parser. This resolves 7 shift/reduce conflicts. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/parse_type_name.c \ src/tests/usr.bin/xlint/lint1/parse_type_name.exp cvs rdiff -u -r1.335 -r1.336 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/parse_type_name.c diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.3 src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.4 --- src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.3 Sun Jul 25 09:53:01 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sun Jul 25 15:48:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_type_name.c,v 1.3 2021/07/25 09:53:01 rillig Exp $ */ +/* $NetBSD: parse_type_name.c,v 1.4 2021/07/25 15:48:58 rillig Exp $ */ # 3 "parse_type_name.c" /* @@ -48,6 +48,7 @@ cover_abstract_declarator(void) sink(sizeof(int **[3])); /* cover 'T_TYPEOF cast_expression' */ + /* expect+1: error: cannot take size/alignment of function [144] */ sink(sizeof(int(typeof(12345; } Index: src/tests/usr.bin/xlint/lint1/parse_type_name.exp diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.3 src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.4 --- src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.3 Sun Jul 25 09:53:01 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.exp Sun Jul 25 15:48:58 2021 @@ -1,6 +1,7 @@ -parse_type_name.c(71): error: null dimension [17] -parse_type_name.c(75): error: null dimension [17] -parse_type_name.c(141): error: syntax error 'goto' [249] -parse_type_name.c(143): error: syntax error 'goto' [249] -parse_type_name.c(149): error: syntax error 'goto' [249] -parse_type_name.c(163): warning: ANSI C requires formal parameter before '...' [84] +parse_type_name.c(52): error: cannot take size/alignment of function [144] +parse_type_name.c(72): error: null dimension [17] +parse_type_name.c(76): error: null dimension [17] +parse_type_name.c(142): error: syntax error 'goto' [249] +parse_type_name.c(144): error: syntax error 'goto' [249] +parse_type_name.c(150): error: syntax error 'goto' [249] +parse_type_name.c(164): warning: ANSI C requires formal parameter before '...' [84] Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.335 src/usr.bin/xlint/lint1/cgram.y:1.336 --- src/usr.bin/xlint/lint1/cgram.y:1.335 Fri Jul 23 15:14:49 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Jul 25 15:48:57 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.335 2021/07/23 15:14:49 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.336 2021/07/25 15:48:57 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.335 2021/07/23 15:14:49 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.336 2021/07/25 15:48:57 rillig Exp $"); #endif #include @@ -124,7 +124,7 @@ anonymize(sym_t *s) %} -%expect 165 +%expect 158 %union { val_t *y_val; @@ -1390,9 +1390,6 @@ abstract_declarator: /* C99 6.7.6 */ | pointer direct_abstract_declarator { $$ = add_pointer($2, $1); } - | T_TYPEOF cast_expression { /* GCC extension */ - $$ = mktempsym($2->tn_type); - } ; direct_abstract_declarator: /* C99 6.7.6 */
Re: CVS commit: src
Hi, "Jared D. McNeill" writes: > Module Name: src > Committed By: jmcneill > Date: Sat Jul 24 11:39:19 UTC 2021 > > Modified Files: > src/etc: MAKEDEV.tmpl > src/etc/etc.aarch64: MAKEDEV.conf > src/etc/etc.amd64: MAKEDEV.conf > src/etc/etc.i386: MAKEDEV.conf > src/sys/arch/arm/fdt: acpi_fdt.c > src/sys/arch/x86/x86: bios32.c > src/sys/conf: majors > src/sys/dev: smbios.c smbiosvar.h > > Log Message: > smbios: Add character device for accessing SMBIOS tables > > The /dev/smbios character device gives an aperture into physical memory > that allows read-only access to the SMBIOS header and tables. Thanks for your great work. bios32.c fails to build for me. My error message is as follows. Could you take a look at my problem? --- bios32.o --- /usr/src/sys/arch/x86/x86/bios32.c: In function 'smbios2_map_kva': /usr/src/sys/arch/x86/x86/bios32.c:255:33: error: passing argument 1 of 'vtophys' makes integer from pointer without a cast [-Werror=int-conversion] 255 | smbios_entry.hdrphys = vtophys(p); | ^ | | | const uint8_t * {aka const unsigned char *} In file included from ./machine/pmap.h:200, from /usr/src/sys/uvm/uvm_pmap.h:115, from /usr/src/sys/uvm/uvm_extern.h:533, from /usr/src/sys/uvm/uvm.h:40, from /usr/src/sys/arch/x86/x86/bios32.c:104: ./x86/pmap.h:534:17: note: expected 'vaddr_t' {aka 'long unsigned int'} but argument is of type 'const uint8_t *' {aka 'const unsigned char *'} 534 | paddr_t vtophys(vaddr_t); | ^~~ /usr/src/sys/arch/x86/x86/bios32.c: In function 'smbios3_map_kva': /usr/src/sys/arch/x86/x86/bios32.c:290:33: error: passing argument 1 of 'vtophys' makes integer from pointer without a cast [-Werror=int-conversion] 290 | smbios_entry.hdrphys = vtophys(p); | ^ | | | const uint8_t * {aka const unsigned char *} In file included from ./machine/pmap.h:200, from /usr/src/sys/uvm/uvm_pmap.h:115, from /usr/src/sys/uvm/uvm_extern.h:533, from /usr/src/sys/uvm/uvm.h:40, from /usr/src/sys/arch/x86/x86/bios32.c:104: ./x86/pmap.h:534:17: note: expected 'vaddr_t' {aka 'long unsigned int'} but argument is of type 'const uint8_t *' {aka 'const unsigned char *'} 534 | paddr_t vtophys(vaddr_t); | ^~~ cc1: all warnings being treated as errors *** Failed target: bios32.o *** Failed commands: ${NORMAL_C} *** [bios32.o] Error code 1 Thank you. > To generate a diff of this commit: > cvs rdiff -u -r1.223 -r1.224 src/etc/MAKEDEV.tmpl > cvs rdiff -u -r1.8 -r1.9 src/etc/etc.aarch64/MAKEDEV.conf > cvs rdiff -u -r1.32 -r1.33 src/etc/etc.amd64/MAKEDEV.conf > cvs rdiff -u -r1.33 -r1.34 src/etc/etc.i386/MAKEDEV.conf > cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/fdt/acpi_fdt.c > cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/x86/bios32.c > cvs rdiff -u -r1.97 -r1.98 src/sys/conf/majors > cvs rdiff -u -r1.1 -r1.2 src/sys/dev/smbios.c src/sys/dev/smbiosvar.h > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. > > Modified files: > > Index: src/etc/MAKEDEV.tmpl > diff -u src/etc/MAKEDEV.tmpl:1.223 src/etc/MAKEDEV.tmpl:1.224 > --- src/etc/MAKEDEV.tmpl:1.223Tue Jun 29 10:22:33 2021 > +++ src/etc/MAKEDEV.tmpl Sat Jul 24 11:39:18 2021 > @@ -1,5 +1,5 @@ > #!/bin/sh - > -#$NetBSD: MAKEDEV.tmpl,v 1.223 2021/06/29 10:22:33 nia Exp $ > +#$NetBSD: MAKEDEV.tmpl,v 1.224 2021/07/24 11:39:18 jmcneill Exp $ > # > # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc. > # All rights reserved. > @@ -2240,6 +2240,10 @@ acpi) > mkdev acpi c %acpi_chr% 0 > ;; > > +smbios) > + mkdev smbios c %smbios_chr% 0 > + ;; > + > midevend) > %MI_DEVICES_END% > local) > > Index: src/etc/etc.aarch64/MAKEDEV.conf > diff -u src/etc/etc.aarch64/MAKEDEV.conf:1.8 > src/etc/etc.aarch64/MAKEDEV.conf:1.9 > --- src/etc/etc.aarch64/MAKEDEV.conf:1.8 Sun Dec 6 02:57:30 2020 > +++ src/etc/etc.aarch64/MAKEDEV.conf Sat Jul 24 11:39:18 2021 > @@ -1,4 +1,4 @@ > -# $NetBSD: MAKEDEV.conf,v 1.8 2020/12/06 02:57:30 jmcneill Exp $ > +# $NetBSD: MAKEDEV.conf,v 1.9 2021/07/24 11:39:18 jmcneill Exp $ > > all_md) > makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 > @@ -21,6 +21,7 @@ all_md) > makedev bpf > makedev openfirm > makedev acpi > + makedev smbios > ;; > > ramdisk|floppy) > > Index: src/etc/etc.amd64/MAKEDEV.conf > diff -u src/etc/etc.amd64/MAKEDEV.conf:1.32 > src/etc/etc.amd64/MAKEDEV.conf:1.33 > --- src/etc/etc.amd64/MAKEDEV.conf:1.32 Sun Dec 6 02:57:30 2020 > +++ src/etc/etc.amd64/MAKEDEV.confSat Jul
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 11:19:51 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_typeof.c gcc_typeof.exp Log Message: tests/lint: document parse error for GCC typeof To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_typeof.c \ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp 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/gcc_typeof.c diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.1 src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.2 --- src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.1 Sun Jul 25 10:57:38 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.c Sun Jul 25 11:19:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_typeof.c,v 1.1 2021/07/25 10:57:38 rillig Exp $ */ +/* $NetBSD: gcc_typeof.c,v 1.2 2021/07/25 11:19:51 rillig Exp $ */ # 3 "gcc_typeof.c" /* @@ -10,6 +10,13 @@ void take_double(typeof(0.0)); void take_function_double_returning_double( +/* + * FIXME: lint's grammar uses 'typeof cast_expression', while GCC's + * c_parser_typeof_specifier uses 'typeof ( expression )'. The crucial + * difference is that lint parses the following expression as 'typeof + * ((0.0)(typeof(0.0))', that is, it tries to call the function 0.0, + * which of course is nonsense. + */ typeof(0.0)( /* FIXME: GCC can parse this */ /* expect+1: error: syntax error 'typeof' [249] */ Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.exp diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.1 src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.2 --- src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.1 Sun Jul 25 10:57:38 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp Sun Jul 25 11:19:51 2021 @@ -1,2 +1,2 @@ -gcc_typeof.c(16): error: syntax error 'typeof' [249] -gcc_typeof.c(26): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155] +gcc_typeof.c(23): error: syntax error 'typeof' [249] +gcc_typeof.c(33): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155]
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: jmcneill Date: Sun Jul 25 11:14:16 UTC 2021 Modified Files: src/sys/arch/arm/rockchip: rk_anxdp.c Log Message: rockchip: edp: Force VOPB as CRTC for eDP. Fixes display init on Pinebook Pro w/ U-Boot 2021.07. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_anxdp.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/arch/arm/rockchip/rk_anxdp.c diff -u src/sys/arch/arm/rockchip/rk_anxdp.c:1.3 src/sys/arch/arm/rockchip/rk_anxdp.c:1.4 --- src/sys/arch/arm/rockchip/rk_anxdp.c:1.3 Wed Jan 27 03:10:19 2021 +++ src/sys/arch/arm/rockchip/rk_anxdp.c Sun Jul 25 11:14:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_anxdp.c,v 1.3 2021/01/27 03:10:19 thorpej Exp $ */ +/* $NetBSD: rk_anxdp.c,v 1.4 2021/07/25 11:14:15 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.3 2021/01/27 03:10:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_anxdp.c,v 1.4 2021/07/25 11:14:15 jmcneill Exp $"); #include #include @@ -172,7 +172,7 @@ rk_anxdp_ep_activate(device_t dev, struc break; } - sc->sc_encoder.possible_crtcs = 0x3; /* XXX */ + sc->sc_encoder.possible_crtcs = 0x2; /* VOPB only */ drm_encoder_init(crtc->dev, >sc_encoder, _anxdp_encoder_funcs, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(>sc_encoder, _anxdp_encoder_helper_funcs);
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 10:57:38 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile Added Files: src/tests/usr.bin/xlint/lint1: gcc_typeof.c gcc_typeof.exp Log Message: tests/lint: demonstrate missing support for GCC typeof To generate a diff of this commit: cvs rdiff -u -r1.1093 -r1.1094 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.94 -r1.95 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/gcc_typeof.c \ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1093 src/distrib/sets/lists/tests/mi:1.1094 --- src/distrib/sets/lists/tests/mi:1.1093 Sun Jul 25 09:29:20 2021 +++ src/distrib/sets/lists/tests/mi Sun Jul 25 10:57:38 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1093 2021/07/25 09:29:20 rillig Exp $ +# $NetBSD: mi,v 1.1094 2021/07/25 10:57:38 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6258,6 +6258,8 @@ ./usr/tests/usr.bin/xlint/lint1/gcc_init_compound_literal.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/gcc_stmt_asm.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/gcc_stmt_asm.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/gcc_typeof.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/gcc_typeof.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/gcc_typeof_after_statement.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/init.ctests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.94 src/tests/usr.bin/xlint/lint1/Makefile:1.95 --- src/tests/usr.bin/xlint/lint1/Makefile:1.94 Sun Jul 25 09:29:20 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jul 25 10:57:38 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.94 2021/07/25 09:29:20 rillig Exp $ +# $NetBSD: Makefile,v 1.95 2021/07/25 10:57:38 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -156,6 +156,8 @@ FILES+= gcc_init_compound_literal.c FILES+= gcc_init_compound_literal.exp FILES+= gcc_stmt_asm.c FILES+= gcc_stmt_asm.exp +FILES+= gcc_typeof.c +FILES+= gcc_typeof.exp FILES+= gcc_typeof_after_statement.c FILES+= gcc_typeof_after_statement.exp FILES+= init.c Added files: Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.1 --- /dev/null Sun Jul 25 10:57:38 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.c Sun Jul 25 10:57:38 2021 @@ -0,0 +1,35 @@ +/* $NetBSD: gcc_typeof.c,v 1.1 2021/07/25 10:57:38 rillig Exp $ */ +# 3 "gcc_typeof.c" + +/* + * Tests for the GCC extension 'typeof'. + * + * https://gcc.gnu.org/onlinedocs/gcc/Typeof.html + */ + +void take_double(typeof(0.0)); + +void take_function_double_returning_double( +typeof(0.0)( + /* FIXME: GCC can parse this */ + /* expect+1: error: syntax error 'typeof' [249] */ + typeof(0.0) +) +); + +void +cast(double(*fn)(double)) +{ + take_double(0.0); + + /* expect+1: warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155] */ + take_double(fn); + + /* XXX: oops; GCC detects this type mismatch. probably due to the parse error. */ + take_function_double_returning_double(0.0); + + take_function_double_returning_double(fn); + + /* identity cast */ + take_function_double_returning_double((double (*)(double))fn); +} Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.1 --- /dev/null Sun Jul 25 10:57:38 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp Sun Jul 25 10:57:38 2021 @@ -0,0 +1,2 @@ +gcc_typeof.c(16): error: syntax error 'typeof' [249] +gcc_typeof.c(26): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155]
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 10:39:10 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_147.c msg_147.exp src/usr.bin/xlint/lint1: err.c tree.c Log Message: lint: add type information to message about invalid cast This probably doesn't matter in practice since the compiler is supposed to catch this kind of error. Adding the type information mainly ensures that parsing abstract type names works as specified. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_147.c \ src/tests/usr.bin/xlint/lint1/msg_147.exp cvs rdiff -u -r1.130 -r1.131 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.318 -r1.319 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_147.c diff -u src/tests/usr.bin/xlint/lint1/msg_147.c:1.3 src/tests/usr.bin/xlint/lint1/msg_147.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_147.c:1.3 Sun Jul 25 10:26:46 2021 +++ src/tests/usr.bin/xlint/lint1/msg_147.c Sun Jul 25 10:39:10 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_147.c,v 1.3 2021/07/25 10:26:46 rillig Exp $ */ +/* $NetBSD: msg_147.c,v 1.4 2021/07/25 10:39:10 rillig Exp $ */ # 3 "msg_147.c" -// Test for message: invalid cast expression [147] +// Test for message: invalid cast from '%s' to '%s' [147] // The type name 'int(int)' is a 'function(int) returning int'. void take(int(int)); @@ -10,7 +10,6 @@ void take(int(int)); void call_take(int (*ptr)(int)) { - /* XXX: That's a little too unspecific. */ - /* expect+1: error: invalid cast expression [147] */ + /* expect+1: error: invalid cast from 'pointer to function(int) returning int' to 'function(int) returning int' [147] */ take((int(int))ptr); } Index: src/tests/usr.bin/xlint/lint1/msg_147.exp diff -u src/tests/usr.bin/xlint/lint1/msg_147.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_147.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_147.exp:1.3 Sun Jul 25 10:26:46 2021 +++ src/tests/usr.bin/xlint/lint1/msg_147.exp Sun Jul 25 10:39:10 2021 @@ -1 +1 @@ -msg_147.c(15): error: invalid cast expression [147] +msg_147.c(14): error: invalid cast from 'pointer to function(int) returning int' to 'function(int) returning int' [147] Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.130 src/usr.bin/xlint/lint1/err.c:1.131 --- src/usr.bin/xlint/lint1/err.c:1.130 Thu Jul 15 20:05:49 2021 +++ src/usr.bin/xlint/lint1/err.c Sun Jul 25 10:39:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.130 2021/07/15 20:05:49 rillig Exp $ */ +/* $NetBSD: err.c,v 1.131 2021/07/25 10:39:10 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.130 2021/07/15 20:05:49 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.131 2021/07/25 10:39:10 rillig Exp $"); #endif #include @@ -201,7 +201,7 @@ const char *const msgs[] = { "cannot take size/alignment of function", /* 144 */ "cannot take size/alignment of bit-field", /* 145 */ "cannot take size/alignment of void", /* 146 */ - "invalid cast expression", /* 147 */ + "invalid cast from '%s' to '%s'", /* 147 */ "improper cast of void expression", /* 148 */ "illegal function (type %s)", /* 149 */ "argument mismatch: %d arg%s passed, %d expected", /* 150 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.318 src/usr.bin/xlint/lint1/tree.c:1.319 --- src/usr.bin/xlint/lint1/tree.c:1.318 Tue Jul 20 19:44:36 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jul 25 10:39:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.318 2021/07/20 19:44:36 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.319 2021/07/25 10:39:10 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.318 2021/07/20 19:44:36 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.319 2021/07/25 10:39:10 rillig Exp $"); #endif #include @@ -3423,15 +3423,10 @@ cast(tnode_t *tn, type_t *tp) error(329, type_name(tn->tn_type), type_name(tp)); return NULL; } else if (nt == STRUCT || nt == ARRAY || nt == FUNC) { - if (!Sflag || nt == ARRAY || nt == FUNC) { - /* invalid cast expression */ - error(147); - return NULL; - } + if (!Sflag || nt == ARRAY || nt == FUNC) + goto invalid_cast; } else if (ot == STRUCT || ot == UNION) { - /* invalid cast expression */ - error(147); - return NULL; + goto invalid_cast; } else if (ot == VOID) { /* improper cast of void expression */ error(148); @@ -3448,16 +3443,18 @@ cast(tnode_t *tn, type_t *tp) /* cast discards 'const' from type '%s' */ warning(275, type_name(tn->tn_type)); } - } else { - /* invalid cast expression */ - error(147); - return NULL; - } + } else +
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 10:26:46 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_110.c msg_110.exp msg_147.c msg_147.exp Log Message: tests/lint: test function types and pointer arithmetic To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_110.c \ src/tests/usr.bin/xlint/lint1/msg_110.exp \ src/tests/usr.bin/xlint/lint1/msg_147.c \ src/tests/usr.bin/xlint/lint1/msg_147.exp 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_110.c diff -u src/tests/usr.bin/xlint/lint1/msg_110.c:1.2 src/tests/usr.bin/xlint/lint1/msg_110.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_110.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_110.c Sun Jul 25 10:26:46 2021 @@ -1,7 +1,15 @@ -/* $NetBSD: msg_110.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_110.c,v 1.3 2021/07/25 10:26:46 rillig Exp $ */ # 3 "msg_110.c" // Test for message: pointer to function is not allowed here [110] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* ARGSUSED */ +void +call_take(int (*ptr)(int)) +{ + /* expect+1: error: pointer to function is not allowed here [110] */ + ptr++; + + /* expect+1: error: pointer to function is not allowed here [110] */ + ptr + 1; +} Index: src/tests/usr.bin/xlint/lint1/msg_110.exp diff -u src/tests/usr.bin/xlint/lint1/msg_110.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_110.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_110.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_110.exp Sun Jul 25 10:26:46 2021 @@ -1 +1,2 @@ -msg_110.c(6): error: syntax error ':' [249] +msg_110.c(11): error: pointer to function is not allowed here [110] +msg_110.c(14): error: pointer to function is not allowed here [110] Index: src/tests/usr.bin/xlint/lint1/msg_147.c diff -u src/tests/usr.bin/xlint/lint1/msg_147.c:1.2 src/tests/usr.bin/xlint/lint1/msg_147.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_147.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_147.c Sun Jul 25 10:26:46 2021 @@ -1,7 +1,16 @@ -/* $NetBSD: msg_147.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_147.c,v 1.3 2021/07/25 10:26:46 rillig Exp $ */ # 3 "msg_147.c" // Test for message: invalid cast expression [147] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +// The type name 'int(int)' is a 'function(int) returning int'. +void take(int(int)); + +/* ARGSUSED */ +void +call_take(int (*ptr)(int)) +{ + /* XXX: That's a little too unspecific. */ + /* expect+1: error: invalid cast expression [147] */ + take((int(int))ptr); +} Index: src/tests/usr.bin/xlint/lint1/msg_147.exp diff -u src/tests/usr.bin/xlint/lint1/msg_147.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_147.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_147.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_147.exp Sun Jul 25 10:26:46 2021 @@ -1 +1 @@ -msg_147.c(6): error: syntax error ':' [249] +msg_147.c(15): error: invalid cast expression [147]
CVS commit: src/tests/usr.sbin/execsnoop
Module Name:src Committed By: gson Date: Sun Jul 25 10:21:44 UTC 2021 Modified Files: src/tests/usr.sbin/execsnoop: t_execsnoop.sh Log Message: Remove "pkill -9 execsnoop". It's wrong on so many levels: first of all, it does not actually kill anything because the process executing the execsnoop script is called "sh", not "execsnoop". And even if it would somehow kill the shell running the execsnoop script, it still would not kill the dtrace child process. On the other hand, if there happened to be an unrelated process actually called "execsnoop", it would kill that. The actual killing of the execsnoop sh and dtrace processes happens in the ATF cleanup stage (as it always has). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.sbin/execsnoop/t_execsnoop.sh 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.sbin/execsnoop/t_execsnoop.sh diff -u src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.6 src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.7 --- src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.6 Sun Jul 25 10:11:32 2021 +++ src/tests/usr.sbin/execsnoop/t_execsnoop.sh Sun Jul 25 10:21:44 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_execsnoop.sh,v 1.6 2021/07/25 10:11:32 gson Exp $ +# $NetBSD: t_execsnoop.sh,v 1.7 2021/07/25 10:21:44 gson Exp $ # # Copyright (c) 2020 The NetBSD Foundation, Inc. # All rights reserved. @@ -49,8 +49,6 @@ basic_body() { done sleep 5 - pkill -9 execsnoop - sleep 1 if [ ! $(cat $tmp | grep "whoami" | wc -l) -eq 10 ]; then atf_fail "execsnoop does not work"
CVS commit: src/tests/usr.sbin/execsnoop
Module Name:src Committed By: gson Date: Sun Jul 25 10:11:32 UTC 2021 Modified Files: src/tests/usr.sbin/execsnoop: t_execsnoop.sh Log Message: Increase sleep waiting for execsnoop to start; one second is not sufficient on a Dell Latitude D400 i386 laptop. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.sbin/execsnoop/t_execsnoop.sh 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.sbin/execsnoop/t_execsnoop.sh diff -u src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.5 src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.6 --- src/tests/usr.sbin/execsnoop/t_execsnoop.sh:1.5 Sat Jul 24 15:56:05 2021 +++ src/tests/usr.sbin/execsnoop/t_execsnoop.sh Sun Jul 25 10:11:32 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_execsnoop.sh,v 1.5 2021/07/24 15:56:05 gson Exp $ +# $NetBSD: t_execsnoop.sh,v 1.6 2021/07/25 10:11:32 gson Exp $ # # Copyright (c) 2020 The NetBSD Foundation, Inc. # All rights reserved. @@ -41,7 +41,7 @@ basic_body() { n=10 atf_check -s exit:0 -o ignore -e empty -x "execsnoop > $tmp &" - sleep 1 + sleep 5 while [ $n -gt 0 ]; do whoami
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 09:53:01 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: parse_type_name.c parse_type_name.exp Log Message: tests/lint: try harder to reduce 'abstract_declarator: T_TYPEOF' At the top level of a type_name, declaration-specifiers take precedence, but these cannot look inside the parentheses of a direct-abstract-declarator. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/parse_type_name.c \ src/tests/usr.bin/xlint/lint1/parse_type_name.exp 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/parse_type_name.c diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.2 src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.3 --- src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.2 Sun Jul 25 09:47:08 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sun Jul 25 09:53:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_type_name.c,v 1.2 2021/07/25 09:47:08 rillig Exp $ */ +/* $NetBSD: parse_type_name.c,v 1.3 2021/07/25 09:53:01 rillig Exp $ */ # 3 "parse_type_name.c" /* @@ -48,15 +48,7 @@ cover_abstract_declarator(void) sink(sizeof(int **[3])); /* cover 'T_TYPEOF cast_expression' */ - sink(sizeof(typeof(12345))); - /* expect+1: error: illegal type combination [4] */ - sink(sizeof(typeof(12345) typeof(12345))); - /* - * TODO: Remove this grammar rule. No matter how often typeof occurs - * in the expression, it is already covered by abstract_declaration > - * begin_type_specifier_qualifier_list > begin_type_typespec > - * notype_type_specifier > T_TYPEOF. It can never reduce this rule. - */ + sink(sizeof(int(typeof(12345; } void Index: src/tests/usr.bin/xlint/lint1/parse_type_name.exp diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.2 src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.3 --- src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.2 Sun Jul 25 09:47:08 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.exp Sun Jul 25 09:53:01 2021 @@ -1,7 +1,6 @@ -parse_type_name.c(53): error: illegal type combination [4] -parse_type_name.c(79): error: null dimension [17] -parse_type_name.c(83): error: null dimension [17] +parse_type_name.c(71): error: null dimension [17] +parse_type_name.c(75): error: null dimension [17] +parse_type_name.c(141): error: syntax error 'goto' [249] +parse_type_name.c(143): error: syntax error 'goto' [249] parse_type_name.c(149): error: syntax error 'goto' [249] -parse_type_name.c(151): error: syntax error 'goto' [249] -parse_type_name.c(157): error: syntax error 'goto' [249] -parse_type_name.c(171): warning: ANSI C requires formal parameter before '...' [84] +parse_type_name.c(163): warning: ANSI C requires formal parameter before '...' [84]
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 09:47:08 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: parse_type_name.c parse_type_name.exp Log Message: tests/lint: document unreachable 'abstract_declarator: T_TYPEOF' To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/parse_type_name.c \ src/tests/usr.bin/xlint/lint1/parse_type_name.exp 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/parse_type_name.c diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.1 src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.2 --- src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.1 Sun Jul 25 08:42:28 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sun Jul 25 09:47:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_type_name.c,v 1.1 2021/07/25 08:42:28 rillig Exp $ */ +/* $NetBSD: parse_type_name.c,v 1.2 2021/07/25 09:47:08 rillig Exp $ */ # 3 "parse_type_name.c" /* @@ -48,7 +48,15 @@ cover_abstract_declarator(void) sink(sizeof(int **[3])); /* cover 'T_TYPEOF cast_expression' */ - /* TODO */ + sink(sizeof(typeof(12345))); + /* expect+1: error: illegal type combination [4] */ + sink(sizeof(typeof(12345) typeof(12345))); + /* + * TODO: Remove this grammar rule. No matter how often typeof occurs + * in the expression, it is already covered by abstract_declaration > + * begin_type_specifier_qualifier_list > begin_type_typespec > + * notype_type_specifier > T_TYPEOF. It can never reduce this rule. + */ } void Index: src/tests/usr.bin/xlint/lint1/parse_type_name.exp diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.1 src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.2 --- src/tests/usr.bin/xlint/lint1/parse_type_name.exp:1.1 Sun Jul 25 08:42:28 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.exp Sun Jul 25 09:47:08 2021 @@ -1,6 +1,7 @@ -parse_type_name.c(71): error: null dimension [17] -parse_type_name.c(75): error: null dimension [17] -parse_type_name.c(141): error: syntax error 'goto' [249] -parse_type_name.c(143): error: syntax error 'goto' [249] +parse_type_name.c(53): error: illegal type combination [4] +parse_type_name.c(79): error: null dimension [17] +parse_type_name.c(83): error: null dimension [17] parse_type_name.c(149): error: syntax error 'goto' [249] -parse_type_name.c(163): warning: ANSI C requires formal parameter before '...' [84] +parse_type_name.c(151): error: syntax error 'goto' [249] +parse_type_name.c(157): error: syntax error 'goto' [249] +parse_type_name.c(171): warning: ANSI C requires formal parameter before '...' [84]
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 09:29:20 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile Added Files: src/tests/usr.bin/xlint/lint1: parse_stmt_error.c parse_stmt_error.exp parse_stmt_iter_error.c parse_stmt_iter_error.exp Log Message: tests/lint: test parse errors in statements These errors are really unrealistic. Most parse errors that occur in statements are already handled elsewhere and continue with the next semicolon. The tests had to be split into two separate files because lint assumes that after the 5th parse error, it does not make sense to continue this translation unit. To generate a diff of this commit: cvs rdiff -u -r1.1092 -r1.1093 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.93 -r1.94 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/parse_stmt_error.c \ src/tests/usr.bin/xlint/lint1/parse_stmt_error.exp \ src/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.c \ src/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1092 src/distrib/sets/lists/tests/mi:1.1093 --- src/distrib/sets/lists/tests/mi:1.1092 Sun Jul 25 08:42:28 2021 +++ src/distrib/sets/lists/tests/mi Sun Jul 25 09:29:20 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1092 2021/07/25 08:42:28 rillig Exp $ +# $NetBSD: mi,v 1.1093 2021/07/25 09:29:20 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6990,6 +6990,10 @@ ./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_stmt_error.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_stmt_error.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_type_name.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/parse_type_name.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/stmt_for.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.93 src/tests/usr.bin/xlint/lint1/Makefile:1.94 --- src/tests/usr.bin/xlint/lint1/Makefile:1.93 Sun Jul 25 08:42:28 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jul 25 09:29:20 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.93 2021/07/25 08:42:28 rillig Exp $ +# $NetBSD: Makefile,v 1.94 2021/07/25 09:29:20 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -196,6 +196,10 @@ FILES+= op_colon.c FILES+= op_colon.exp FILES+= op_shl_lp64.c FILES+= op_shl_lp64.exp +FILES+= parse_stmt_error.c +FILES+= parse_stmt_error.exp +FILES+= parse_stmt_iter_error.c +FILES+= parse_stmt_iter_error.exp FILES+= parse_type_name.c FILES+= parse_type_name.exp FILES+= stmt_for.c Added files: Index: src/tests/usr.bin/xlint/lint1/parse_stmt_error.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/parse_stmt_error.c:1.1 --- /dev/null Sun Jul 25 09:29:20 2021 +++ src/tests/usr.bin/xlint/lint1/parse_stmt_error.c Sun Jul 25 09:29:20 2021 @@ -0,0 +1,26 @@ +/* $NetBSD: parse_stmt_error.c,v 1.1 2021/07/25 09:29:20 rillig Exp $ */ +# 3 "parse_stmt_error.c" + +/* + * Test parsing of errors in selection statements (if, switch). + */ + +void do_nothing(void); + +void +cover_selection_statement_else(_Bool cond) +{ + if (cond) + do_nothing(); + else + /* expect+1: syntax error ']' [249] */ + ]; +} + +void +cover_selection_statement_switch(int x) +{ + switch (x) + /* expect+1: syntax error ']' [249] */ + ]; +} Index: src/tests/usr.bin/xlint/lint1/parse_stmt_error.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/parse_stmt_error.exp:1.1 --- /dev/null Sun Jul 25 09:29:20 2021 +++ src/tests/usr.bin/xlint/lint1/parse_stmt_error.exp Sun Jul 25 09:29:20 2021 @@ -0,0 +1,2 @@ +parse_stmt_error.c(17): error: syntax error ']' [249] +parse_stmt_error.c(25): error: syntax error ']' [249] Index: src/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.c:1.1 --- /dev/null Sun Jul 25 09:29:20 2021 +++ src/tests/usr.bin/xlint/lint1/parse_stmt_iter_error.c Sun Jul 25 09:29:20 2021 @@ -0,0 +1,32 @@ +/* $NetBSD: parse_stmt_iter_error.c,v 1.1 2021/07/25 09:29:20 rillig Exp $ */ +# 3 "parse_stmt_iter_error.c" + +/* + * Test parsing of
CVS commit: src
Module Name:src Committed By: simonb Date: Sun Jul 25 08:52:03 UTC 2021 Modified Files: src/lib/libc/stdio: mktemp.3 src/usr.bin/mktemp: mktemp.1 Log Message: Update to reflect current reality for template characters - the process ID is not longer used and we replace each "X" with one of 64 values not 26 values. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/lib/libc/stdio/mktemp.3 cvs rdiff -u -r1.23 -r1.24 src/usr.bin/mktemp/mktemp.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/stdio/mktemp.3 diff -u src/lib/libc/stdio/mktemp.3:1.30 src/lib/libc/stdio/mktemp.3:1.31 --- src/lib/libc/stdio/mktemp.3:1.30 Thu Jun 19 09:30:33 2014 +++ src/lib/libc/stdio/mktemp.3 Sun Jul 25 08:52:03 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: mktemp.3,v 1.30 2014/06/19 09:30:33 wiz Exp $ +.\" $NetBSD: mktemp.3,v 1.31 2021/07/25 08:52:03 simonb Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93 .\" -.Dd June 18, 2014 +.Dd July 25, 2021 .Dt MKTEMP 3 .Os .Sh NAME @@ -67,33 +67,26 @@ This file name is unique and suitable fo by the application. The template may be any file name with some number of .So Li X -.Sc Ns s -appended -to it, for example +characters appended to it, for example .Pa /tmp/temp.XX . The trailing .So Li X -.Sc Ns s -are replaced with the current process number and/or a -unique letter combination. -The number of unique file names +characters in the template are replaced with a unique letter and number +combination. .Fn mktemp can return depends on the number of .So Li X -.Sc Ns s -provided. +characters provided. Although the .Nx implementation of the functions will accept any number of trailing .So Li X -.Sc Ns s , -for portability reasons one should use only six. +characters, for portability reasons one should use only six. Using six .So Li X -.Sc Ns s -will result in +characters will result in .Fn mktemp -testing roughly 26 ** 6 (308915776) combinations. +testing roughly 62 ** 6 (56800235584) combinations. .Pp The .Fn mkstemp Index: src/usr.bin/mktemp/mktemp.1 diff -u src/usr.bin/mktemp/mktemp.1:1.23 src/usr.bin/mktemp/mktemp.1:1.24 --- src/usr.bin/mktemp/mktemp.1:1.23 Mon Jul 3 21:34:20 2017 +++ src/usr.bin/mktemp/mktemp.1 Sun Jul 25 08:52:03 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: mktemp.1,v 1.23 2017/07/03 21:34:20 wiz Exp $ +.\" $NetBSD: mktemp.1,v 1.24 2021/07/25 08:52:03 simonb Exp $ .\" From: $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $ .\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $ .\" @@ -31,7 +31,7 @@ .\" .\" $FreeBSD: src/usr.bin/mktemp/mktemp.1,v 1.5 1999/08/28 01:04:13 peter Exp $ .\" -.Dd November 4, 2012 +.Dd July 25, 2021 .Dt MKTEMP 1 .Os .Sh NAME @@ -61,8 +61,8 @@ characters, such as .Pa /tmp/prefix. . The trailing .Ql X -characters in the template are replaced by unique values derived from -the current process number and additional letters or numbers. +characters in the template are replaced with a unique letter and number +combination. Any .Ql X characters other than at the end of the template are taken literally. @@ -74,7 +74,7 @@ in the template; six .Ql X Ns s will result in .Nm -testing roughly 26 ** 6 combinations. +testing roughly 62 ** 6 (56800235584) combinations. .Pp The templates used to create the unique names are derived from the .Fl t Ar prefix
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Jul 25 08:42:28 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile decl.c decl.exp Added Files: src/tests/usr.bin/xlint/lint1: parse_type_name.c parse_type_name.exp Log Message: tests/lint: test parsing of type_name To generate a diff of this commit: cvs rdiff -u -r1.1091 -r1.1092 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.92 -r1.93 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/decl.exp cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/parse_type_name.c \ src/tests/usr.bin/xlint/lint1/parse_type_name.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1091 src/distrib/sets/lists/tests/mi:1.1092 --- src/distrib/sets/lists/tests/mi:1.1091 Thu Jul 15 21:00:05 2021 +++ src/distrib/sets/lists/tests/mi Sun Jul 25 08:42:28 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1091 2021/07/15 21:00:05 rillig Exp $ +# $NetBSD: mi,v 1.1092 2021/07/25 08:42:28 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6990,6 +6990,8 @@ ./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_type_name.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/parse_type_name.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/stmt_for.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/stmt_for.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/stmt_goto.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.92 src/tests/usr.bin/xlint/lint1/Makefile:1.93 --- src/tests/usr.bin/xlint/lint1/Makefile:1.92 Thu Jul 15 21:00:05 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jul 25 08:42:28 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.92 2021/07/15 21:00:05 rillig Exp $ +# $NetBSD: Makefile,v 1.93 2021/07/25 08:42:28 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -196,6 +196,8 @@ FILES+= op_colon.c FILES+= op_colon.exp FILES+= op_shl_lp64.c FILES+= op_shl_lp64.exp +FILES+= parse_type_name.c +FILES+= parse_type_name.exp FILES+= stmt_for.c FILES+= stmt_for.exp FILES+= stmt_goto.c Index: src/tests/usr.bin/xlint/lint1/decl.c diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.10 src/tests/usr.bin/xlint/lint1/decl.c:1.11 --- src/tests/usr.bin/xlint/lint1/decl.c:1.10 Fri Jul 23 15:21:47 2021 +++ src/tests/usr.bin/xlint/lint1/decl.c Sun Jul 25 08:42:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.10 2021/07/23 15:21:47 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.11 2021/07/25 08:42:28 rillig Exp $ */ # 3 "decl.c" /* @@ -128,13 +128,6 @@ unused_linted(void) /* covers 'type_qualifier_list: type_qualifier_list type_qualifier' */ int *const volatile cover_type_qualifier_list; -unsigned long cover_abstract_declaration_declmods = sizeof(const); -unsigned long cover_abstract_declaration_declmods_abstract_declarator = -sizeof(const *); - -unsigned long cover_abstract_declarator_typeof = -sizeof(const typeof(cover_abstract_declaration_declmods)); - _Bool bool; char plain_char; signed char signed_char; Index: src/tests/usr.bin/xlint/lint1/decl.exp diff -u src/tests/usr.bin/xlint/lint1/decl.exp:1.6 src/tests/usr.bin/xlint/lint1/decl.exp:1.7 --- src/tests/usr.bin/xlint/lint1/decl.exp:1.6 Fri Jul 23 15:21:47 2021 +++ src/tests/usr.bin/xlint/lint1/decl.exp Sun Jul 25 08:42:28 2021 @@ -9,6 +9,6 @@ decl.c(68): warning: converting 'pointer decl.c(70): warning: illegal combination of pointer (pointer to double) and integer (char), arg #1 [154] decl.c(72): warning: converting 'pointer to pointer to char' to incompatible 'pointer to double' for argument 1 [153] decl.c(80): error: syntax error '"' [249] -decl.c(170): error: syntax error 'int' [249] -decl.c(173): error: syntax error 'int' [249] +decl.c(163): error: syntax error 'int' [249] +decl.c(166): error: syntax error 'int' [249] decl.c(114): warning: static function unused unused [236] Added files: Index: src/tests/usr.bin/xlint/lint1/parse_type_name.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.1 --- /dev/null Sun Jul 25 08:42:28 2021 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sun Jul 25 08:42:28 2021 @@ -0,0 +1,200 @@ +/* $NetBSD: parse_type_name.c,v 1.1 2021/07/25 08:42:28 rillig Exp $ */ +# 3 "parse_type_name.c" + +/* + * Test parsing of
CVS commit: src
Module Name:src Committed By: nia Date: Sun Jul 25 07:35:55 UTC 2021 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4/man4.x86: Makefile Added Files: src/share/man/man4/man4.x86: amdccp.4 Log Message: Add a man page for amdccp(4) To generate a diff of this commit: cvs rdiff -u -r1.1723 -r1.1724 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.22 -r1.23 src/share/man/man4/man4.x86/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/man4.x86/amdccp.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1723 src/distrib/sets/lists/man/mi:1.1724 --- src/distrib/sets/lists/man/mi:1.1723 Tue Jun 29 10:22:34 2021 +++ src/distrib/sets/lists/man/mi Sun Jul 25 07:35:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1723 2021/06/29 10:22:34 nia Exp $ +# $NetBSD: mi,v 1.1724 2021/07/25 07:35:55 nia Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -2074,6 +2074,7 @@ ./usr/share/man/cat4/x68k/pow.0 man-obsolete obsolete ./usr/share/man/cat4/x68k/powsw.0 man-sys-catman .cat ./usr/share/man/cat4/x68k/vs.0 man-sys-catman .cat +./usr/share/man/cat4/x86/amdccp.0 man-sys-catman .cat ./usr/share/man/cat4/x86/amdpcib.0 man-sys-catman .cat ./usr/share/man/cat4/x86/amdsmn.0 man-sys-catman .cat ./usr/share/man/cat4/x86/amdzentemp.0 man-sys-catman .cat @@ -5230,6 +5231,7 @@ ./usr/share/man/html4/x68k/pow.html man-obsolete obsolete ./usr/share/man/html4/x68k/powsw.html man-sys-htmlman html ./usr/share/man/html4/x68k/vs.html man-sys-htmlman html +./usr/share/man/html4/x86/amdccp.html man-sys-htmlman html ./usr/share/man/html4/x86/amdpcib.html man-sys-htmlman html ./usr/share/man/html4/x86/amdsmn.html man-sys-htmlman html ./usr/share/man/html4/x86/amdzentemp.html man-sys-htmlman html @@ -8318,6 +8320,7 @@ ./usr/share/man/man4/x68k/pow.4 man-obsolete obsolete ./usr/share/man/man4/x68k/powsw.4 man-sys-man .man ./usr/share/man/man4/x68k/vs.4 man-sys-man .man +./usr/share/man/man4/x86/amdccp.4 man-sys-man .man ./usr/share/man/man4/x86/amdpcib.4 man-sys-man .man ./usr/share/man/man4/x86/amdsmn.4 man-sys-man .man ./usr/share/man/man4/x86/amdzentemp.4 man-sys-man .man Index: src/share/man/man4/man4.x86/Makefile diff -u src/share/man/man4/man4.x86/Makefile:1.22 src/share/man/man4/man4.x86/Makefile:1.23 --- src/share/man/man4/man4.x86/Makefile:1.22 Thu Jun 3 07:41:26 2021 +++ src/share/man/man4/man4.x86/Makefile Sun Jul 25 07:35:55 2021 @@ -1,9 +1,8 @@ -# $NetBSD: Makefile,v 1.22 2021/06/03 07:41:26 wiz Exp $ +# $NetBSD: Makefile,v 1.23 2021/07/25 07:35:55 nia Exp $ -MAN= amdpcib.4 apic.4 autoconf.4 balloon.4 console.4 coretemp.4 est.4 fdc.4 \ - fwhrng.4 hpet.4 ichlpcib.4 imcsmb.4 lpt.4 mem.4 odcm.4 powernow.4 \ - soekrisgpio.4 tco.4 \ - amdsmn.4 amdzentemp.4 +MAN= amdccp.4 amdpcib.4 apic.4 autoconf.4 balloon.4 console.4 coretemp.4 \ + est.4 fdc.4 fwhrng.4 hpet.4 ichlpcib.4 imcsmb.4 lpt.4 mem.4 odcm.4 \ + powernow.4 soekrisgpio.4 tco.4 amdsmn.4 amdzentemp.4 MLINKS+=apic.4 ioapic.4 \ apic.4 lapic.4 Added files: Index: src/share/man/man4/man4.x86/amdccp.4 diff -u /dev/null src/share/man/man4/man4.x86/amdccp.4:1.1 --- /dev/null Sun Jul 25 07:35:55 2021 +++ src/share/man/man4/man4.x86/amdccp.4 Sun Jul 25 07:35:55 2021 @@ -0,0 +1,54 @@ +.\" $NetBSD: amdccp.4,v 1.1 2021/07/25 07:35:55 nia Exp $ +.\" +.\" Copyright (c) 2021 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 25, 2021 +.Dt AMDCCP
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: skrll Date: Sun Jul 25 06:10:01 UTC 2021 Modified Files: src/sys/ufs/lfs: ulfs_quota1_subr.c Log Message: #include for COHERENCY_UNIT (and KNF) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/ufs/lfs/ulfs_quota1_subr.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/ufs/lfs/ulfs_quota1_subr.c diff -u src/sys/ufs/lfs/ulfs_quota1_subr.c:1.3 src/sys/ufs/lfs/ulfs_quota1_subr.c:1.4 --- src/sys/ufs/lfs/ulfs_quota1_subr.c:1.3 Thu Jun 6 00:49:28 2013 +++ src/sys/ufs/lfs/ulfs_quota1_subr.c Sun Jul 25 06:10:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ulfs_quota1_subr.c,v 1.3 2013/06/06 00:49:28 dholland Exp $ */ +/* $NetBSD: ulfs_quota1_subr.c,v 1.4 2021/07/25 06:10:01 skrll Exp $ */ /* from NetBSD: quota1_subr.c,v 1.7 2012/01/29 06:23:20 dholland Exp */ /*- @@ -28,12 +28,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ulfs_quota1_subr.c,v 1.3 2013/06/06 00:49:28 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ulfs_quota1_subr.c,v 1.4 2021/07/25 06:10:01 skrll Exp $"); +#include #include -#include - #include + #include static uint64_t
CVS commit: src/external/cddl/osnet/sys/kern
Module Name:src Committed By: skrll Date: Sun Jul 25 06:07:42 UTC 2021 Modified Files: src/external/cddl/osnet/sys/kern: opensolaris.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/sys/kern/opensolaris.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/sys/kern/opensolaris.c diff -u src/external/cddl/osnet/sys/kern/opensolaris.c:1.2 src/external/cddl/osnet/sys/kern/opensolaris.c:1.3 --- src/external/cddl/osnet/sys/kern/opensolaris.c:1.2 Mon May 28 21:05:09 2018 +++ src/external/cddl/osnet/sys/kern/opensolaris.c Sun Jul 25 06:07:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opensolaris.c,v 1.2 2018/05/28 21:05:09 chs Exp $ */ +/* $NetBSD: opensolaris.c,v 1.3 2021/07/25 06:07:42 skrll Exp $ */ /*- * Copyright 2007 John Birrell * @@ -28,11 +28,12 @@ */ #include +#include #include + #include #include #include -#include #include #include #include
CVS commit: src/sys/kern
Module Name:src Committed By: simonb Date: Sun Jul 25 06:06:40 UTC 2021 Modified Files: src/sys/kern: vfs_bio.c Log Message: If we're only doing a count-only kern.buf sysctl, just return the number of active members in the pool cache (plus some slop) instead of looking in all the free buffer list. Should reduce CPU usage for "systat vm" to << 1% especially for machines with a larger number of buffers. To generate a diff of this commit: cvs rdiff -u -r1.300 -r1.301 src/sys/kern/vfs_bio.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/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.300 src/sys/kern/vfs_bio.c:1.301 --- src/sys/kern/vfs_bio.c:1.300 Sat Jul 24 13:28:14 2021 +++ src/sys/kern/vfs_bio.c Sun Jul 25 06:06:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.300 2021/07/24 13:28:14 simonb Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.301 2021/07/25 06:06:40 simonb Exp $ */ /*- * Copyright (c) 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.300 2021/07/24 13:28:14 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.301 2021/07/25 06:06:40 simonb Exp $"); #ifdef _KERNEL_OPT #include "opt_bufcache.h" @@ -1804,6 +1804,14 @@ sysctl_dobuf(SYSCTLFN_ARGS) elem_size < 1 || elem_count < 0) return (EINVAL); + if (oldp == NULL) { + /* count only, don't run through the buffer queues */ + needed = pool_cache_nget(buf_cache) - pool_cache_nput(buf_cache); + *oldlenp = (needed + KERN_BUFSLOP) * elem_size; + + return 0; + } + error = 0; needed = 0; sysctl_unlock(); @@ -1848,8 +1856,6 @@ sysctl_dobuf(SYSCTLFN_ARGS) sysctl_relock(); *oldlenp = needed; - if (oldp == NULL) - *oldlenp += KERN_BUFSLOP * elem_size; return (error); }
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun Jul 25 06:04:40 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: decl_arg.c decl_arg.exp Log Message: tests/lint: demonstrate internal error in parsing a declaration To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/decl_arg.c cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/decl_arg.exp 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/decl_arg.c diff -u src/tests/usr.bin/xlint/lint1/decl_arg.c:1.5 src/tests/usr.bin/xlint/lint1/decl_arg.c:1.6 --- src/tests/usr.bin/xlint/lint1/decl_arg.c:1.5 Sat Jul 10 09:24:27 2021 +++ src/tests/usr.bin/xlint/lint1/decl_arg.c Sun Jul 25 06:04:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_arg.c,v 1.5 2021/07/10 09:24:27 rillig Exp $ */ +/* $NetBSD: decl_arg.c,v 1.6 2021/07/25 06:04:40 rillig Exp $ */ # 3 "decl_arg.c" /* @@ -55,7 +55,8 @@ struct a_struct { int member; } a_struct } /* - * Just some unrealistic coverage for the grammar rule 'notype_direct_decl'. + * Just some unrealistic coverage for the grammar rule + * 'notype_direct_declarator'. */ extern int cover_notype_direct_decl(arg) @@ -129,3 +130,6 @@ void cover_asm_or_symbolrename_asm(void) void cover_asm_or_symbolrename_symbolrename(void) __symbolrename(alternate_name); + +// FIXME: internal error in decl.c:906 near decl_arg.c:134: length(0) +//void cover_abstract_declarator_typeof(void (*)(typeof(no_args))); Index: src/tests/usr.bin/xlint/lint1/decl_arg.exp diff -u src/tests/usr.bin/xlint/lint1/decl_arg.exp:1.2 src/tests/usr.bin/xlint/lint1/decl_arg.exp:1.3 --- src/tests/usr.bin/xlint/lint1/decl_arg.exp:1.2 Sat Jul 10 08:40:36 2021 +++ src/tests/usr.bin/xlint/lint1/decl_arg.exp Sun Jul 25 06:04:40 2021 @@ -14,15 +14,15 @@ decl_arg.c(30): warning: argument 'a_con decl_arg.c(30): warning: argument 'a_number' unused in function 'old_style' [231] decl_arg.c(30): warning: argument 'a_function' unused in function 'old_style' [231] decl_arg.c(30): warning: argument 'a_struct' unused in function 'old_style' [231] -decl_arg.c(64): error: declared argument name is missing [53] -decl_arg.c(66): error: declared argument parenthesized_name is missing [53] -decl_arg.c(68): error: declared argument array is missing [53] -decl_arg.c(70): error: declared argument array_size is missing [53] -decl_arg.c(73): error: null dimension [17] -decl_arg.c(73): error: declared argument multi_array is missing [53] -decl_arg.c(75): error: declared argument function is missing [53] -decl_arg.c(77): error: declared argument prefix_attribute is missing [53] -decl_arg.c(79): error: declared argument postfix_attribute is missing [53] -decl_arg.c(81): error: declared argument infix_attribute is missing [53] -decl_arg.c(90): error: declared argument pointer_prefix_attribute is missing [53] -decl_arg.c(119): error: only register valid as formal parameter storage class [9] +decl_arg.c(65): error: declared argument name is missing [53] +decl_arg.c(67): error: declared argument parenthesized_name is missing [53] +decl_arg.c(69): error: declared argument array is missing [53] +decl_arg.c(71): error: declared argument array_size is missing [53] +decl_arg.c(74): error: null dimension [17] +decl_arg.c(74): error: declared argument multi_array is missing [53] +decl_arg.c(76): error: declared argument function is missing [53] +decl_arg.c(78): error: declared argument prefix_attribute is missing [53] +decl_arg.c(80): error: declared argument postfix_attribute is missing [53] +decl_arg.c(82): error: declared argument infix_attribute is missing [53] +decl_arg.c(91): error: declared argument pointer_prefix_attribute is missing [53] +decl_arg.c(120): error: only register valid as formal parameter storage class [9]
CVS commit: src/sys
Module Name:src Committed By: simonb Date: Sun Jul 25 06:00:32 UTC 2021 Modified Files: src/sys/kern: subr_pool.c src/sys/sys: pool.h Log Message: Add accessor functions to get the number of gets and puts on pools and pool caches. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.277 src/sys/kern/subr_pool.c cvs rdiff -u -r1.93 -r1.94 src/sys/sys/pool.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_pool.c diff -u src/sys/kern/subr_pool.c:1.276 src/sys/kern/subr_pool.c:1.277 --- src/sys/kern/subr_pool.c:1.276 Wed Feb 24 05:36:02 2021 +++ src/sys/kern/subr_pool.c Sun Jul 25 06:00:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.276 2021/02/24 05:36:02 mrg Exp $ */ +/* $NetBSD: subr_pool.c,v 1.277 2021/07/25 06:00:31 simonb Exp $ */ /* * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018, @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.276 2021/02/24 05:36:02 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.277 2021/07/25 06:00:31 simonb Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1609,6 +1609,20 @@ pool_sethardlimit(struct pool *pp, int n mutex_exit(>pr_lock); } +unsigned int +pool_nget(struct pool *pp) +{ + + return pp->pr_nget; +} + +unsigned int +pool_nput(struct pool *pp) +{ + + return pp->pr_nput; +} + /* * Release all complete pages that have not been used recently. * @@ -2459,6 +2473,20 @@ pool_cache_prime(pool_cache_t pc, int n) pool_prime(>pc_pool, n); } +unsigned int +pool_cache_nget(pool_cache_t pc) +{ + + return pool_nget(>pc_pool); +} + +unsigned int +pool_cache_nput(pool_cache_t pc) +{ + + return pool_nput(>pc_pool); +} + /* * pool_pcg_get: * Index: src/sys/sys/pool.h diff -u src/sys/sys/pool.h:1.93 src/sys/sys/pool.h:1.94 --- src/sys/sys/pool.h:1.93 Wed Feb 24 06:11:38 2021 +++ src/sys/sys/pool.h Sun Jul 25 06:00:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pool.h,v 1.93 2021/02/24 06:11:38 simonb Exp $ */ +/* $NetBSD: pool.h,v 1.94 2021/07/25 06:00:31 simonb Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2000, 2007, 2020 @@ -319,6 +319,9 @@ bool pool_drain(struct pool **); int pool_totalpages(void); int pool_totalpages_locked(void); +unsigned int pool_nget(struct pool *); +unsigned int pool_nput(struct pool *); + /* * Debugging and diagnostic aides. */ @@ -353,6 +356,9 @@ void pool_cache_sethardlimit(pool_cache void pool_cache_prime(pool_cache_t, int); void pool_cache_cpu_init(struct cpu_info *); +unsigned int pool_cache_nget(pool_cache_t); +unsigned int pool_cache_nput(pool_cache_t); + #define pool_cache_get(pc, f) pool_cache_get_paddr((pc), (f), NULL) #define pool_cache_put(pc, o) pool_cache_put_paddr((pc), (o), \ POOL_PADDR_INVALID)