CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jul 10 05:42:30 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: do not allow __packed or _Alignas in statement When the rule 'statement: type_attribute T_SEMI' was added in cgram.y 1.214 from 2021-04-14, type_attribute was the closest match since there was no definition for gcc_attribute yet. To generate a diff of this commit: cvs rdiff -u -r1.281 -r1.282 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.281 src/usr.bin/xlint/lint1/cgram.y:1.282 --- src/usr.bin/xlint/lint1/cgram.y:1.281 Sat Jul 10 05:03:03 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sat Jul 10 05:42:29 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.281 2021/07/10 05:03:03 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.282 2021/07/10 05:42:29 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.281 2021/07/10 05:03:03 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.282 2021/07/10 05:42:29 rillig Exp $"); #endif #include @@ -1365,7 +1365,7 @@ array_size: ; non_expr_statement: - type_attribute T_SEMI + gcc_attribute T_SEMI | labeled_statement | compound_statement | selection_statement
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jul 10 05:03:03 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: reduce shift/reduce conflicts in direct_abstract_declarator No functional change. To generate a diff of this commit: cvs rdiff -u -r1.280 -r1.281 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.280 src/usr.bin/xlint/lint1/cgram.y:1.281 --- src/usr.bin/xlint/lint1/cgram.y:1.280 Sat Jul 10 04:57:41 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sat Jul 10 05:03:03 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.280 2021/07/10 04:57:41 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.281 2021/07/10 05:03: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.280 2021/07/10 04:57:41 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.281 2021/07/10 05:03:03 rillig Exp $"); #endif #include @@ -123,7 +123,7 @@ anonymize(sym_t *s) } %} -%expect 142 +%expect 136 %union { val_t *y_val; @@ -319,6 +319,7 @@ anonymize(sym_t *s) %type identifier_list %type abstract_declarator %type direct_abstract_declarator +%type direct_abstract_declarator_postfix %type vararg_parameter_type_list %type parameter_type_list %type parameter_declaration @@ -1310,12 +1311,14 @@ abstract_declarator: /* C99 6.7.6 */ } ; -/* - * XXX: shift/reduce conflict, caused by: - * type_attribute direct_abstract_declarator - * direct_abstract_declarator type_attribute - */ direct_abstract_declarator: /* C99 6.7.6 */ + direct_abstract_declarator_postfix + | type_attribute direct_abstract_declarator_postfix { + $$ = $2; + } + ; + +direct_abstract_declarator_postfix: /* C99 6.7.6 */ T_LPAREN abstract_declarator T_RPAREN { $$ = $2; } @@ -1325,16 +1328,14 @@ direct_abstract_declarator: /* C99 6.7. | T_LBRACK array_size T_RBRACK { $$ = add_array(abstract_name(), true, to_int_constant($2, false)); } - | type_attribute direct_abstract_declarator { - $$ = $2; - } - | direct_abstract_declarator T_LBRACK T_RBRACK { + | direct_abstract_declarator_postfix T_LBRACK T_RBRACK { $$ = add_array($1, false, 0); } - | direct_abstract_declarator T_LBRACK T_ASTERISK T_RBRACK { /* C99 */ + | direct_abstract_declarator_postfix + T_LBRACK T_ASTERISK T_RBRACK { /* C99 */ $$ = add_array($1, false, 0); } - | direct_abstract_declarator T_LBRACK array_size T_RBRACK { + | direct_abstract_declarator_postfix T_LBRACK array_size T_RBRACK { $$ = add_array($1, true, to_int_constant($3, false)); } | abstract_decl_param_list asm_or_symbolrename_opt { @@ -1342,12 +1343,13 @@ direct_abstract_declarator: /* C99 6.7. end_declaration_level(); block_level--; } - | direct_abstract_declarator abstract_decl_param_list asm_or_symbolrename_opt { + | direct_abstract_declarator_postfix abstract_decl_param_list + asm_or_symbolrename_opt { $$ = add_function(symbolrename($1, $3), $2); end_declaration_level(); block_level--; } - | direct_abstract_declarator type_attribute + | direct_abstract_declarator_postfix type_attribute ; array_size:
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jul 10 04:57:41 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove 8 of the grammar conflicts, 142 remaining No functional change. To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 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.279 src/usr.bin/xlint/lint1/cgram.y:1.280 --- src/usr.bin/xlint/lint1/cgram.y:1.279 Sat Jul 10 04:47:25 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sat Jul 10 04:57:41 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.279 2021/07/10 04:47:25 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.280 2021/07/10 04:57:41 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.279 2021/07/10 04:47:25 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.280 2021/07/10 04:57:41 rillig Exp $"); #endif #include @@ -123,7 +123,7 @@ anonymize(sym_t *s) } %} -%expect 150 +%expect 142 %union { val_t *y_val; @@ -721,26 +721,25 @@ member_declaration: } ; -/* - * XXX: shift/reduce conflict, caused by: - * type_attribute noclass_declspecs - * noclass_declspecs type_attribute - */ noclass_declspecs: + noclass_declspecs_postfix + | type_attribute noclass_declspecs_postfix + ; + +noclass_declspecs_postfix: clrtyp_typespec { add_type($1); } - | type_attribute noclass_declspecs | noclass_declmods typespec { add_type($2); } - | noclass_declspecs T_QUAL { + | noclass_declspecs_postfix T_QUAL { add_qualifier($2); } - | noclass_declspecs notype_typespec { + | noclass_declspecs_postfix notype_typespec { add_type($2); } - | noclass_declspecs type_attribute + | noclass_declspecs_postfix type_attribute ; noclass_declmods:
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jul 10 04:47:25 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: merge duplicate code in declmods and declmod No functional change. To generate a diff of this commit: cvs rdiff -u -r1.278 -r1.279 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.278 src/usr.bin/xlint/lint1/cgram.y:1.279 --- src/usr.bin/xlint/lint1/cgram.y:1.278 Sat Jul 10 04:25:47 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sat Jul 10 04:47:25 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.278 2021/07/10 04:25:47 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.279 2021/07/10 04:47:25 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.278 2021/07/10 04:25:47 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.279 2021/07/10 04:47:25 rillig Exp $"); #endif #include @@ -549,23 +549,22 @@ declaration_specifiers: /* C99 6.7 */ ; declmods: - clrtyp T_QUAL { - add_qualifier($2); - } - | clrtyp T_SCLASS { - add_storage_class($2); - } + clrtyp qualifier_or_storage_class | declmods declmod ; declmod: + qualifier_or_storage_class + | type_attribute + ; + +qualifier_or_storage_class: T_QUAL { add_qualifier($1); } | T_SCLASS { add_storage_class($1); } - | type_attribute ; clrtyp_typespec:
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sat Jul 10 04:25:47 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove duplicate code for parsing declarations No functional change. To generate a diff of this commit: cvs rdiff -u -r1.277 -r1.278 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.277 src/usr.bin/xlint/lint1/cgram.y:1.278 --- src/usr.bin/xlint/lint1/cgram.y:1.277 Fri Jul 9 20:51:27 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sat Jul 10 04:25:47 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.277 2021/07/09 20:51:27 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.278 2021/07/10 04:25: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.277 2021/07/09 20:51:27 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.278 2021/07/10 04:25:47 rillig Exp $"); #endif #include @@ -403,26 +403,7 @@ top_level_declaration: /* C99 6.9 calls warning(1); } } - | declmods deftyp T_SEMI { - if (dcs->d_scl == TYPEDEF) { - /* typedef declares no type name */ - warning(72); - } else { - /* empty declaration */ - warning(2); - } - } - | declmods deftyp notype_init_decls T_SEMI - | declaration_specifiers deftyp T_SEMI { - if (dcs->d_scl == TYPEDEF) { - /* typedef declares no type name */ - warning(72); - } else if (!dcs->d_nonempty_decl) { - /* empty declaration */ - warning(2); - } - } - | declaration_specifiers deftyp type_init_decls T_SEMI + | declaration_noerror | error T_SEMI { global_clean_up(); } @@ -514,6 +495,11 @@ arg_declaration: ; declaration: /* C99 6.7 */ + declaration_noerror + | error T_SEMI + ; + +declaration_noerror: /* see C99 6.7 'declaration' */ declmods deftyp T_SEMI { if (dcs->d_scl == TYPEDEF) { /* typedef declares no type name */ @@ -534,7 +520,6 @@ declaration: /* C99 6.7 */ } } | declaration_specifiers deftyp type_init_decls T_SEMI - | error T_SEMI ; clrtyp:
CVS commit: src/distrib/luna68k/ramdisk
Module Name:src Committed By: tsutsui Date: Sat Jul 10 03:19:12 UTC 2021 Modified Files: src/distrib/luna68k/ramdisk: list Log Message: Use more shrinked binaries from distrib/utils/x_foo versions. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/luna68k/ramdisk/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/luna68k/ramdisk/list diff -u src/distrib/luna68k/ramdisk/list:1.3 src/distrib/luna68k/ramdisk/list:1.4 --- src/distrib/luna68k/ramdisk/list:1.3 Thu Feb 20 14:30:23 2014 +++ src/distrib/luna68k/ramdisk/list Sat Jul 10 03:19:12 2021 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.3 2014/02/20 14:30:23 tsutsui Exp $ +# $NetBSD: list,v 1.4 2021/07/10 03:19:12 tsutsui Exp $ SRCDIRS bin sbin usr.bin usr.sbin @@ -57,10 +57,13 @@ PROG usr/sbin/chroot # init invokes the shell as -sh ARGVLN sh -sh +SPECIAL disklabel srcdir distrib/utils/x_disklabel SPECIAL ed srcdir distrib/utils/x_ed SPECIAL gzip srcdir distrib/utils/x_gzip +SPECIAL fsck_ffs srcdir distrib/utils/x_fsck_ffs SPECIAL ifconfig srcdir distrib/utils/x_ifconfig SPECIAL more srcdir distrib/utils/more +SPECIAL newfs srcdir distrib/utils/x_newfs SPECIAL ping srcdir distrib/utils/x_ping SPECIAL route srcdir distrib/utils/x_route SPECIAL umount srcdir distrib/utils/x_umount
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 9 20:51:27 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove 6 conflicts from the grammar, in type_direct_decl No functional change. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.277 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.276 src/usr.bin/xlint/lint1/cgram.y:1.277 --- src/usr.bin/xlint/lint1/cgram.y:1.276 Fri Jul 9 20:36:34 2021 +++ src/usr.bin/xlint/lint1/cgram.y Fri Jul 9 20:51:27 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.276 2021/07/09 20:36:34 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.277 2021/07/09 20:51: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.276 2021/07/09 20:36:34 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.277 2021/07/09 20:51:27 rillig Exp $"); #endif #include @@ -123,7 +123,7 @@ anonymize(sym_t *s) } %} -%expect 156 +%expect 150 %union { val_t *y_val; @@ -949,9 +949,12 @@ notype_decl: ; type_decl: - type_direct_decl - | pointer type_direct_decl { - $$ = add_pointer($2, $1); + /* TODO: removing type_attribute_list_opt here removes another 16 conflicts */ + type_attribute_list_opt type_direct_decl { + $$ = $2; + } + | pointer type_attribute_list_opt type_direct_decl { + $$ = add_pointer($3, $1); } ; @@ -976,11 +979,6 @@ notype_direct_decl: | notype_direct_decl type_attribute ; -/* - * XXX: shift/reduce conflict, caused by: - * type_attribute type_direct_decl - * type_direct_decl type_attribute - */ type_direct_decl: identifier { $$ = declarator_name(getsym($1)); @@ -988,9 +986,6 @@ type_direct_decl: | T_LPAREN type_decl T_RPAREN { $$ = $2; } - | type_attribute type_direct_decl { - $$ = $2; - } | type_direct_decl T_LBRACK T_RBRACK { $$ = add_array($1, false, 0); }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 9 20:36:34 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: remove 6 of the remaining 162 conflicts from the grammar No functional change. To generate a diff of this commit: cvs rdiff -u -r1.275 -r1.276 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.275 src/usr.bin/xlint/lint1/cgram.y:1.276 --- src/usr.bin/xlint/lint1/cgram.y:1.275 Fri Jul 9 06:37:11 2021 +++ src/usr.bin/xlint/lint1/cgram.y Fri Jul 9 20:36:34 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.275 2021/07/09 06:37:11 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.276 2021/07/09 20:36:34 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.275 2021/07/09 06:37:11 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.276 2021/07/09 20:36:34 rillig Exp $"); #endif #include @@ -123,7 +123,7 @@ anonymize(sym_t *s) } %} -%expect 162 +%expect 156 %union { val_t *y_val; @@ -939,9 +939,12 @@ type_init_decl: ; notype_decl: - notype_direct_decl - | pointer notype_direct_decl { - $$ = add_pointer($2, $1); + /* TODO: removing type_attribute_list_opt here removes another 18 conflicts */ + type_attribute_list_opt notype_direct_decl { + $$ = $2; + } + | pointer type_attribute_list_opt notype_direct_decl { + $$ = add_pointer($3, $1); } ; @@ -952,11 +955,6 @@ type_decl: } ; -/* - * XXX: shift/reduce conflict, caused by: - * type_attribute notype_direct_decl - * notype_direct_decl type_attribute - */ notype_direct_decl: T_NAME { $$ = declarator_name(getsym($1)); @@ -964,9 +962,6 @@ notype_direct_decl: | T_LPAREN type_decl T_RPAREN { $$ = $2; } - | type_attribute notype_direct_decl { - $$ = $2; - } | notype_direct_decl T_LBRACK T_RBRACK { $$ = add_array($1, false, 0); }
CVS commit: src
Module Name:src Committed By: rillig Date: Fri Jul 9 20:20:03 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: decl_arg.c decl_arg.exp Log Message: tests/lint: add test for unrealistic edge cases in declarations The example code for triggering these grammar rules looks completely contrived. Even if lint had not implemented these cases, hopefully nobody would have ever noticed. To generate a diff of this commit: cvs rdiff -u -r1.1080 -r1.1081 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.81 -r1.82 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/decl_arg.c \ 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/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1080 src/distrib/sets/lists/tests/mi:1.1081 --- src/distrib/sets/lists/tests/mi:1.1080 Fri Jul 9 05:54:11 2021 +++ src/distrib/sets/lists/tests/mi Fri Jul 9 20:20:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1080 2021/07/09 05:54:11 yamaguchi Exp $ +# $NetBSD: mi,v 1.1081 2021/07/09 20:20:03 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6210,6 +6210,8 @@ ./usr/tests/usr.bin/xlint/lint1/d_typefun.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_typename_as_var.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/d_zero_sized_arrays.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/decl_arg.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/decl_arg.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/decl_struct_member.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/decl_struct_member.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/emit.ctests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.81 src/tests/usr.bin/xlint/lint1/Makefile:1.82 --- src/tests/usr.bin/xlint/lint1/Makefile:1.81 Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Fri Jul 9 20:20:03 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.81 2021/07/08 05:18:49 rillig Exp $ +# $NetBSD: Makefile,v 1.82 2021/07/09 20:20:03 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -108,6 +108,8 @@ FILES+= d_type_question_colon.c FILES+= d_typefun.c FILES+= d_typename_as_var.c FILES+= d_zero_sized_arrays.c +FILES+= decl_arg.c +FILES+= decl_arg.exp FILES+= decl_struct_member.c FILES+= decl_struct_member.exp FILES+= emit.c Added files: Index: src/tests/usr.bin/xlint/lint1/decl_arg.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/decl_arg.c:1.1 --- /dev/null Fri Jul 9 20:20:03 2021 +++ src/tests/usr.bin/xlint/lint1/decl_arg.c Fri Jul 9 20:20:03 2021 @@ -0,0 +1,93 @@ +/* $NetBSD: decl_arg.c,v 1.1 2021/07/09 20:20:03 rillig Exp $ */ +# 3 "decl_arg.c" + +/* + * Tests for declarations of function arguments. + * + * See arg_declaration in cgram.y. + */ + +typedef double number; + +void no_args(void); +void type_unnamed(double ); +void type_named(double arg); +void typedef_unnamed_prototype(number); +void typedef_named(number arg); + +void type_qualifier(const number); +void type_qualifier_pointer(const number *const); + +/* + * Just some unrealistic coverage for the grammar rule 'arg_declaration'. + */ +/* expect+6: warning: argument 'an_int' unused in function 'old_style' [231] */ +/* expect+5: warning: argument 'a_const_int' unused in function 'old_style' [231] */ +/* expect+4: warning: argument 'a_number' unused in function 'old_style' [231] */ +/* expect+3: warning: argument 'a_function' unused in function 'old_style' [231] */ +/* expect+2: warning: argument 'a_struct' unused in function 'old_style' [231] */ +extern void +old_style(an_int, a_const_int, a_number, a_function, a_struct) +/* expect+2: warning: empty declaration [2] */ +/* expect+1: error: only register valid as formal parameter storage class [9] */ +static; +/* expect+1: error: syntax error '"' [249] */ +static "error"; +/* expect+1: warning: empty declaration [2] */ +const; +/* expect+1: error: declared argument undeclared is missing [53] */ +const undeclared; +/* expect+2: error: declared argument undeclared_initialized is missing [53] */ +/* expect+1: error: cannot initialize parameter: undeclared_initialized [52] */ +const undeclared_initialized = 12345; +/* expect+1: warning: empty declaration [2] */ +int; +/* expect+1: warning: 'struct arg_struct' declared in argument declaration list [3] */ +struct arg_struct { int member; }; +/* expect+1: error: cannot initialize parameter: an_int [52] */ +int an_int = 12345; +const int
CVS commit: src/tests/lib/libc/stdio
Module Name:src Committed By: kre Date: Fri Jul 9 20:00:26 UTC 2021 Modified Files: src/tests/lib/libc/stdio: h_intr.c Log Message: Make opts.cmd const char * rather than char * -- nothing ever modifies the string it points to, it is never passed to a function not taking a const char * arg, and this allows "" (or other literal strings if ever needed) to be assigned to it - which should fix the build. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/stdio/h_intr.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/lib/libc/stdio/h_intr.c diff -u src/tests/lib/libc/stdio/h_intr.c:1.3 src/tests/lib/libc/stdio/h_intr.c:1.4 --- src/tests/lib/libc/stdio/h_intr.c:1.3 Fri Jul 9 15:26:59 2021 +++ src/tests/lib/libc/stdio/h_intr.c Fri Jul 9 20:00:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: h_intr.c,v 1.3 2021/07/09 15:26:59 christos Exp $ */ +/* $NetBSD: h_intr.c,v 1.4 2021/07/09 20:00:26 kre Exp $ */ /** * Test of interrupted I/O to popen()ed commands. @@ -25,7 +25,7 @@ */ #include -__RCSID("$NetBSD: h_intr.c,v 1.3 2021/07/09 15:26:59 christos Exp $"); +__RCSID("$NetBSD: h_intr.c,v 1.4 2021/07/09 20:00:26 kre Exp $"); #include #include @@ -53,7 +53,7 @@ static void usage(FILE *fp); /* Globals */ static struct options { - char* cmd; /* cmd to run (which must read from stdin) */ + const char* cmd; /* cmd to run (which must read from stdin) */ size_t bsize; /* block size to use */ size_t asize; /* alt. stdio buffer size */ int btype; /* buffering type: _IONBF, ... */
CVS commit: src/distrib/hp300/ramdisk
Module Name:src Committed By: tsutsui Date: Fri Jul 9 19:11:06 UTC 2021 Modified Files: src/distrib/hp300/ramdisk: list Log Message: Use more shrinked binaries from distrib/utils/x_foo versions. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/distrib/hp300/ramdisk/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/hp300/ramdisk/list diff -u src/distrib/hp300/ramdisk/list:1.24 src/distrib/hp300/ramdisk/list:1.25 --- src/distrib/hp300/ramdisk/list:1.24 Fri Jan 14 10:26:32 2011 +++ src/distrib/hp300/ramdisk/list Fri Jul 9 19:11:06 2021 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.24 2011/01/14 10:26:32 tsutsui Exp $ +# $NetBSD: list,v 1.25 2021/07/09 19:11:06 tsutsui Exp $ SRCDIRS bin sbin usr.bin usr.sbin @@ -46,8 +46,11 @@ PROG usr/sbin/installboot # init invokes the shell as -sh ARGVLN sh -sh +SPECIAL disklabel srcdir distrib/utils/x_disklabel +SPECIAL fsck_ffs srcdir distrib/utils/x_fsck_ffs SPECIAL gzip srcdir distrib/utils/x_gzip SPECIAL ifconfig srcdir distrib/utils/x_ifconfig +SPECIAL newfs srcdir distrib/utils/x_newfs SPECIAL ping srcdir distrib/utils/x_ping SPECIAL route srcdir distrib/utils/x_route SPECIAL umount srcdir distrib/utils/x_umount
CVS commit: src/etc/etc.hp300
Module Name:src Committed By: tsutsui Date: Fri Jul 9 19:01:29 UTC 2021 Modified Files: src/etc/etc.hp300: MAKEDEV.conf Log Message: Create rd3 device nodes, for HPDisk. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/etc/etc.hp300/MAKEDEV.conf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/etc.hp300/MAKEDEV.conf diff -u src/etc/etc.hp300/MAKEDEV.conf:1.14 src/etc/etc.hp300/MAKEDEV.conf:1.15 --- src/etc/etc.hp300/MAKEDEV.conf:1.14 Sun Apr 28 08:08:04 2013 +++ src/etc/etc.hp300/MAKEDEV.conf Fri Jul 9 19:01:29 2021 @@ -1,7 +1,7 @@ -# $NetBSD: MAKEDEV.conf,v 1.14 2013/04/28 08:08:04 tsutsui Exp $ +# $NetBSD: MAKEDEV.conf,v 1.15 2021/07/09 19:01:29 tsutsui Exp $ all_md) - makedev ct0 ct1 rd0 rd1 rd2 + makedev ct0 ct1 rd0 rd1 rd2 rd3 makedev wscons makedev sd0 sd1 sd2 cd0 cd1 st0 st1 ch0 makedev ttyC0 ttyC1 ttyC2 ttyC3 @@ -15,7 +15,7 @@ all_md) ramdisk) makedev std makedev md0 - makedev ct0 ct1 rd0 rd1 rd2 + makedev ct0 ct1 rd0 rd1 rd2 rd3 makedev sd0 sd1 sd2 cd0 cd1 st0 st1 ch0 makedev scsibus0 makedev ipty
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 9 18:55:28 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: gcc_attribute.c Log Message: tests/lint: ensure that GCC __attribute__ can be parsed To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/gcc_attribute.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/gcc_attribute.c diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.8 src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.9 --- src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.8 Tue Jul 6 18:43:27 2021 +++ src/tests/usr.bin/xlint/lint1/gcc_attribute.c Fri Jul 9 18:55:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gcc_attribute.c,v 1.8 2021/07/06 18:43:27 rillig Exp $ */ +/* $NetBSD: gcc_attribute.c,v 1.9 2021/07/09 18:55:28 rillig Exp $ */ # 3 "gcc_attribute.c" /* @@ -84,3 +84,36 @@ void one_empty_attribute(void) */ void two_empty_attributes(void) __attribute__((/* none */, /* still none */)); + +/* + * Ensure that __attribute__ can be specified everywhere in a declaration. + * This is the simplest possible requirement that covers all valid code. + * It accepts invalid code as well, but these cases are covered by GCC and + * Clang already. + * + * Since lint only parses the attributes but doesn't really relate them to + * identifiers or other entities, ensuring that valid code can be parsed is + * enough for now. + * + * To really associate __attribute__ with the corresponding entity, the + * grammar needs to be rewritten, see the example with __noreturn__ above. + */ +__attribute__((deprecated("d1"))) +const +__attribute__((deprecated("d2"))) +int +__attribute__((deprecated("d3"))) +* +// The below line would produce a syntax error. +// __attribute__((deprecated("d3"))) +const +__attribute__((deprecated("d4"))) +identifier +__attribute__((deprecated("d5"))) +( +__attribute__((deprecated("d6"))) +void +__attribute__((deprecated("d7"))) +) +__attribute__((deprecated("d8"))) +;
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Fri Jul 9 17:53:05 UTC 2021 Modified Files: src/doc [netbsd-9]: CHANGES-9.3 Log Message: Ticket #1321 To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/doc/CHANGES-9.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.3 diff -u src/doc/CHANGES-9.3:1.1.2.15 src/doc/CHANGES-9.3:1.1.2.16 --- src/doc/CHANGES-9.3:1.1.2.15 Thu Jul 8 11:24:41 2021 +++ src/doc/CHANGES-9.3 Fri Jul 9 17:53:05 2021 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.3,v 1.1.2.15 2021/07/08 11:24:41 martin Exp $ +# $NetBSD: CHANGES-9.3,v 1.1.2.16 2021/07/09 17:53:05 martin Exp $ A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3 release: @@ -349,3 +349,8 @@ sys/external/bsd/drm2/linux/linux_reserv drm: Release fence after use. [riastradh, ticket #1320] +sys/rump/librump/rumpvfs/vm_vfs.c (apply patch) + + Adapt the uvm pageout changes to the branch. + [chs, ticket #1321] +
CVS commit: [netbsd-9] src/sys/rump/librump/rumpvfs
Module Name:src Committed By: martin Date: Fri Jul 9 17:51:17 UTC 2021 Modified Files: src/sys/rump/librump/rumpvfs [netbsd-9]: vm_vfs.c Log Message: Apply patch, requested by chs in ticket #1321: sys/rump/librump/rumpvfs/vm_vfs.c (apply patch) Adapt the changes from ticket #1317 (the uvm_pageqlock does not exist any more in HEAD) To generate a diff of this commit: cvs rdiff -u -r1.34.34.1 -r1.34.34.2 src/sys/rump/librump/rumpvfs/vm_vfs.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/rump/librump/rumpvfs/vm_vfs.c diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.34.34.1 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.34.34.2 --- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.34.34.1 Tue Jul 6 04:22:34 2021 +++ src/sys/rump/librump/rumpvfs/vm_vfs.c Fri Jul 9 17:51:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_vfs.c,v 1.34.34.1 2021/07/06 04:22:34 martin Exp $ */ +/* $NetBSD: vm_vfs.c,v 1.34.34.2 2021/07/09 17:51:17 martin Exp $ */ /* * Copyright (c) 2008-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.34.34.1 2021/07/06 04:22:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.34.34.2 2021/07/09 17:51:17 martin Exp $"); #include @@ -44,6 +44,7 @@ uvm_aio_aiodone_pages(struct vm_page **p int i; mutex_enter(uobj->vmobjlock); + mutex_enter(_pageqlock); for (i = 0; i < npages; i++) { pg = pgs[i]; KASSERT((pg->flags & PG_PAGEOUT) == 0 || @@ -59,6 +60,7 @@ uvm_aio_aiodone_pages(struct vm_page **p } uvm_page_unbusy(pgs, npages); + mutex_exit(_pageqlock); mutex_exit(uobj->vmobjlock); }
CVS commit: src/sys/arch/hp300/stand
Module Name:src Committed By: tsutsui Date: Fri Jul 9 17:44:28 UTC 2021 Modified Files: src/sys/arch/hp300/stand: Makefile.buildboot Log Message: Specify -fno-unwind-tables to shrink binaries. Before: textdata bss dec hex filename 779024328 137120 219350 358d6 uboot After: textdata bss dec hex filename 641864328 137120 205634 32342 uboot To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/hp300/stand/Makefile.buildboot 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/hp300/stand/Makefile.buildboot diff -u src/sys/arch/hp300/stand/Makefile.buildboot:1.36 src/sys/arch/hp300/stand/Makefile.buildboot:1.37 --- src/sys/arch/hp300/stand/Makefile.buildboot:1.36 Sat Apr 8 19:53:20 2017 +++ src/sys/arch/hp300/stand/Makefile.buildboot Fri Jul 9 17:44:28 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.buildboot,v 1.36 2017/04/08 19:53:20 christos Exp $ +# $NetBSD: Makefile.buildboot,v 1.37 2021/07/09 17:44:28 tsutsui Exp $ # RELOC=FFF0 allows for boot prog up to FF000 (1044480) bytes long RELOC= FFF0 @@ -20,7 +20,7 @@ CLEANFILES+= ${PROGAOUT} CPPFLAGS+= -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -I${.OBJDIR} CPPFLAGS+= -Wno-main CPPFLAGS+= -D__daddr_t=int32_t -CFLAGS= -Os -msoft-float -ffreestanding +CFLAGS= -Os -fno-unwind-tables -msoft-float -ffreestanding # XXX SHOULD NOT NEED TO DEFINE THESE! LIBCRT0=
CVS commit: src/doc
Module Name:src Committed By: tsutsui Date: Fri Jul 9 17:07:29 UTC 2021 Modified Files: src/doc: CHANGES Log Message: Mention about hp300 rd(4) improvements for HPDisk. To generate a diff of this commit: cvs rdiff -u -r1.2814 -r1.2815 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2814 src/doc/CHANGES:1.2815 --- src/doc/CHANGES:1.2814 Tue Jul 6 12:26:03 2021 +++ src/doc/CHANGES Fri Jul 9 17:07:29 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2814 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2815 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -385,3 +385,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0: arm: Switch to GCC 10. [mrg 20210619] uscanner(4): Removed from the tree. [nia 20210629] acpi(4): Updated ACPICA to 20210604. [christos 20210706] + hp300: Add support of multiple rd(4) disks on all punits for HPDisk. + [tsutsui 20210709]
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Fri Jul 9 17:05:33 UTC 2021 Modified Files: src/sys/arch/hp300/dev: hpibvar.h rd.c rdreg.h rdvar.h Log Message: Add support of multiple rd(4) disks on all punits for HPDisk. Special thanks to Anders Gustafsson, the author of "HPDisk" (GPIB disk emulator) http://www.dalton.ax/hpdisk/ for providing bare boards and improving firmwares for NetBSD/hp300. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/hp300/dev/hpibvar.h cvs rdiff -u -r1.107 -r1.108 src/sys/arch/hp300/dev/rd.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hp300/dev/rdreg.h cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hp300/dev/rdvar.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/arch/hp300/dev/hpibvar.h diff -u src/sys/arch/hp300/dev/hpibvar.h:1.23 src/sys/arch/hp300/dev/hpibvar.h:1.24 --- src/sys/arch/hp300/dev/hpibvar.h:1.23 Mon Jul 5 14:51:23 2021 +++ src/sys/arch/hp300/dev/hpibvar.h Fri Jul 9 17:05:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: hpibvar.h,v 1.23 2021/07/05 14:51:23 tsutsui Exp $ */ +/* $NetBSD: hpibvar.h,v 1.24 2021/07/09 17:05:33 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -167,7 +167,7 @@ struct hpibbus_attach_args { #define hpibbuscf_punit cf_loc[HPIBBUSCF_PUNIT] #define HPIB_NSLAVES 8 /* number of slaves on a bus */ -#define HPIB_NPUNITS 2 /* number of punits per slave */ +#define HPIB_NPUNITS 15 /* number of punits per slave */ /* * An HP-IB job queue entry. Slave drivers have one of these used Index: src/sys/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.107 src/sys/arch/hp300/dev/rd.c:1.108 --- src/sys/arch/hp300/dev/rd.c:1.107 Mon Jul 5 14:51:23 2021 +++ src/sys/arch/hp300/dev/rd.c Fri Jul 9 17:05:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.107 2021/07/05 14:51:23 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.108 2021/07/09 17:05:33 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.107 2021/07/05 14:51:23 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.108 2021/07/09 17:05:33 tsutsui Exp $"); #include "opt_useleds.h" @@ -186,65 +186,204 @@ int rddebug = RDB_ERROR | RDB_IDENT; * Nothing really critical here, could do without it. */ static const struct rdidentinfo rdidentinfo[] = { - { RD7946AID, 0, "7945A", NRD7945ABPT, - NRD7945ATRK, 968, 108416 }, - - { RD9134DID, 1, "9134D", NRD9134DBPT, - NRD9134DTRK, 303, 29088 }, - - { RD9134LID, 1, "9122S", NRD9122SBPT, - NRD9122STRK, 77, 1232 }, - - { RD7912PID, 0, "7912P", NRD7912PBPT, - NRD7912PTRK, 572, 128128 }, - - { RD7914PID, 0, "7914P", NRD7914PBPT, - NRD7914PTRK, 1152, 258048 }, - - { RD7958AID, 0, "7958A", NRD7958ABPT, - NRD7958ATRK, 1013, 255276 }, - - { RD7957AID, 0, "7957A", NRD7957ABPT, - NRD7957ATRK, 1036, 159544 }, - - { RD7933HID, 0, "7933H", NRD7933HBPT, - NRD7933HTRK, 1321, 789958 }, - - { RD9134LID, 1, "9134L", NRD9134LBPT, - NRD9134LTRK, 973, 77840 }, - - { RD7936HID, 0, "7936H", NRD7936HBPT, - NRD7936HTRK, 698, 600978 }, - - { RD7937HID, 0, "7937H", NRD7937HBPT, - NRD7937HTRK, 698, 1116102 }, - - { RD7914CTID, 0, "7914CT", NRD7914PBPT, - NRD7914PTRK, 1152, 258048 }, - - { RD7946AID, 0, "7946A", NRD7945ABPT, - NRD7945ATRK, 968, 108416 }, - - { RD9134LID, 1, "9122D", NRD9122SBPT, - NRD9122STRK, 77, 1232 }, - - { RD7957BID, 0, "7957B", NRD7957BBPT, - NRD7957BTRK, 1269, 159894 }, - - { RD7958BID, 0, "7958B", NRD7958BBPT, - NRD7958BTRK, 786, 297108 }, - - { RD7959BID, 0, "7959B", NRD7959BBPT, - NRD7959BTRK, 1572, 594216 }, - - { RD2200AID, 0, "2200A", NRD2200ABPT, - NRD2200ATRK, 1449, 654948 }, - - { RD2203AID, 0, "2203A", NRD2203ABPT, - NRD2203ATRK, 1449, 1309896 } + [RD7945A] = { + .ri_hwid = RD7946AID, + .ri_desc = "7945A", + .ri_nbpt = NRD7945ABPT, + .ri_ntpc = NRD7945ATRK, + .ri_ncyl = 968, + .ri_nblocks = 108416 + }, + + [RD9134D] = { + .ri_hwid = RD9134DID, + .ri_desc = "9134D", + .ri_nbpt = NRD9134DBPT, + .ri_ntpc = NRD9134DTRK, + .ri_ncyl = 303, + .ri_nblocks = 29088 + }, + + [RD9122S] = { + .ri_hwid = RD9134LID, + .ri_desc = "9122S", + .ri_nbpt = NRD9122SBPT, + .ri_ntpc = NRD9122STRK, + .ri_ncyl = 77, + .ri_nblocks = 1232 + }, + + [RD7912P] = { + .ri_hwid = RD7912PID, + .ri_desc = "7912P", + .ri_nbpt = NRD7912PBPT, + .ri_ntpc = NRD7912PTRK, + .ri_ncyl = 572, + .ri_nblocks = 128128 + }, + + [RD7914P] = { + .ri_hwid = RD7914PID, + .ri_desc = "7914P", + .ri_nbpt = NRD7914PBPT, + .ri_ntpc = NRD7914PTRK, + .ri_ncyl = 1152, + .ri_nblocks = 258048 + }, + + [RD7958A] = { + .ri_hwid = RD7958AID, + .ri_desc = "7958A", + .ri_nbpt = NRD7958ABPT, + .ri_ntpc = NRD7958ATRK, + .ri_ncyl = 1013, + .ri_nblocks = 255276 + }, + + [RD7957A] = { + .ri_hwid = RD7957AID, + .ri_desc = "7957A", + .ri_nbpt =
CVS commit: src/tests/lib/libc/stdio
Module Name:src Committed By: christos Date: Fri Jul 9 15:26:59 UTC 2021 Modified Files: src/tests/lib/libc/stdio: h_intr.c t_intr.sh Log Message: fixes from RVP To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdio/h_intr.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/stdio/t_intr.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/lib/libc/stdio/h_intr.c diff -u src/tests/lib/libc/stdio/h_intr.c:1.2 src/tests/lib/libc/stdio/h_intr.c:1.3 --- src/tests/lib/libc/stdio/h_intr.c:1.2 Thu Jul 8 11:21:40 2021 +++ src/tests/lib/libc/stdio/h_intr.c Fri Jul 9 11:26:59 2021 @@ -1,20 +1,20 @@ -/* $NetBSD: h_intr.c,v 1.2 2021/07/08 15:21:40 christos Exp $ */ +/* $NetBSD: h_intr.c,v 1.3 2021/07/09 15:26:59 christos Exp $ */ /** - * Test of interrupted writes to popen()'ed commands. + * Test of interrupted I/O to popen()ed commands. * * Example 1: - * ./h_fwrite -c "gzip -t" *.gz + * ./h_intr -c "gzip -t" *.gz * * Example 2: - * while :; do ./h_fwrite -b $((12*1024)) -t 10 -c "bzip2 -t" *.bz2; sleep 2; done + * while :; do ./h_intr -b $((12*1024)) -t 10 -c "bzip2 -t" *.bz2; sleep 2; done * * Example 3: * Create checksum file: * find /mnt -type f -exec sha512 -n {} + >SHA512 * * Check program: - * find /mnt -type f -exec ./h_fwrite -b 512 -c run.sh {} + + * find /mnt -type f -exec ./h_intr -b 512 -c run.sh {} + * * ./run.sh: #!/bin/sh @@ -25,7 +25,7 @@ */ #include -__RCSID("$NetBSD: h_intr.c,v 1.2 2021/07/08 15:21:40 christos Exp $"); +__RCSID("$NetBSD: h_intr.c,v 1.3 2021/07/09 15:26:59 christos Exp $"); #include #include @@ -38,25 +38,29 @@ __RCSID("$NetBSD: h_intr.c,v 1.2 2021/07 #include #include -static int process(const char *fn); +static bool process(const char *fn); ssize_t maxread(FILE *fp, void *buf, size_t size); ssize_t smaxread(FILE *fp, void *buf, size_t size); ssize_t maxwrite(FILE *fp, const void *buf, size_t size); ssize_t smaxwrite(FILE *fp, const void *buf, size_t size); +static int rndbuf(void); +static int rndmode(void); static sig_t xsignal(int signo, sig_t handler); static void alarmtimer(int wait); static void pr_star(int signo); -static bool isvalid(const char *s); static int do_opts(int argc, char* argv[]); -static void usage(FILE* fp); +static void usage(FILE *fp); /* Globals */ static struct options { - size_t bsize; - size_t ssize; - int btype; - int tmout; - const char *cmd; + char* cmd; /* cmd to run (which must read from stdin) */ + size_t bsize; /* block size to use */ + size_t asize; /* alt. stdio buffer size */ + int btype; /* buffering type: _IONBF, ... */ + int tmout; /* alarm timeout */ + int flush; /* call fflush() after write if 1 */ + int rndbuf; /* switch buffer randomly if 1 */ + int rndmod; /* switch buffering modes randomly if 1 */ } opts; static const struct { @@ -68,15 +72,24 @@ static const struct { { "IOFBF", _IOFBF }, }; +static void (*alarm_fn)(int);/* real/dummy alarm fn. */ +static int (*sintr_fn)(int, int); /* " siginterrupt fn. */ +static ssize_t (*rd_fn)(FILE*, void*, size_t); /* read fn. */ +static ssize_t (*wr_fn)(FILE*, const void*, size_t); /* write fn. */ + enum { - MB = 1024 * 1024, - BSIZE = 16 * 1024, - DEF_MS = 100, - MS = 1000, + MB = 1024 * 1024, /* a megabyte */ + BSIZE = 16 * 1024, /* default RW buffer size */ + DEF_MS = 100, /* interrupt 10x a second */ + MS = 1000, /* msecs. in a second */ }; + +/** + * M A I N + */ int main(int argc, char* argv[]) { @@ -100,8 +113,8 @@ main(int argc, char* argv[]) sig_t osig = xsignal(SIGALRM, pr_star); - if (process(argv[i]) == 0) - printf("ok\n"); + if (process(argv[i]) == true) + printf(" OK\n"); else rc = EXIT_FAILURE; @@ -111,46 +124,79 @@ main(int argc, char* argv[]) return rc; } -static int +static bool process(const char *fn) { FILE *ifp, *ofp; - char *buf; + char *buf, *abuf; + int rc = false; size_t nw = 0; - int rc = EXIT_FAILURE; ssize_t n; - if ((buf = malloc(opts.bsize)) == NULL) - err(rc, "buffer alloc failed"); + abuf = NULL; + + if ((buf = malloc(opts.bsize)) == NULL) { + warn("buffer alloc failed"); + return rc; + } + + if ((abuf = malloc(opts.asize)) == NULL) { + warn("alt. buffer alloc failed"); + goto fail; + } if ((ifp = fopen(fn, "r")) == NULL) { warn("fopen failed: %s", fn); - return rc; + goto fail; + } + + if ((ofp = popen(opts.cmd, "w")) == NULL) { + warn("popen failed `%s'", opts.cmd); + goto fail; } - if ((ofp = popen(opts.cmd, "w")) == NULL) - err(rc, "popen failed `%s'", opts.cmd); + setvbuf(ofp, NULL, opts.btype, opts.asize); + setvbuf(ifp, NULL, opts.btype, opts.asize); - setvbuf(ofp, NULL, opts.btype, opts.ssize); - setvbuf(ifp, NULL, opts.btype, opts.ssize); + alarm_fn(opts.tmout); - alarmtimer(opts.tmout); - while ((n = maxread(ifp, buf, opts.bsize)) > 0) { + while
CVS commit: src/lib/libc/stdio
Module Name:src Committed By: christos Date: Fri Jul 9 09:24:16 UTC 2021 Modified Files: src/lib/libc/stdio: fflush.c Log Message: Don't adjust the buffers when write returns 0. This happens with fmemopen and other synthetic write functions. This fixes the unit-tests for fmemopen, but adjusting should be the right behavior for all cases? To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/lib/libc/stdio/fflush.c 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/fflush.c diff -u src/lib/libc/stdio/fflush.c:1.22 src/lib/libc/stdio/fflush.c:1.23 --- src/lib/libc/stdio/fflush.c:1.22 Thu Jul 8 11:44:44 2021 +++ src/lib/libc/stdio/fflush.c Fri Jul 9 05:24:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fflush.c,v 1.22 2021/07/08 15:44:44 christos Exp $ */ +/* $NetBSD: fflush.c,v 1.23 2021/07/09 09:24:16 christos Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fflush.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fflush.c,v 1.22 2021/07/08 15:44:44 christos Exp $"); +__RCSID("$NetBSD: fflush.c,v 1.23 2021/07/09 09:24:16 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -107,7 +107,9 @@ __sflush(FILE *fp) for (; n > 0; n -= t, p += t) { t = (*fp->_write)(fp->_cookie, (char *)p, n); - if (t <= 0) { + if (t == 0) + goto out; + if (t < 0) { /* Reset _p and _w. */ if (p > fp->_p) { /* Some was written. */ @@ -116,6 +118,7 @@ __sflush(FILE *fp) fp->_p += n; if ((fp->_flags & (__SLBF | __SNBF)) == 0) fp->_w -= n; +out: fp->_flags |= __SERR; return EOF; }
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Fri Jul 9 06:37:11 UTC 2021 Modified Files: src/usr.bin/xlint/lint1: cgram.y Log Message: lint: indent grammar actions properly No functional change. To generate a diff of this commit: cvs rdiff -u -r1.274 -r1.275 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.274 src/usr.bin/xlint/lint1/cgram.y:1.275 --- src/usr.bin/xlint/lint1/cgram.y:1.274 Thu Jul 8 19:08:03 2021 +++ src/usr.bin/xlint/lint1/cgram.y Fri Jul 9 06:37:11 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.274 2021/07/08 19:08:03 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.275 2021/07/09 06:37:11 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.274 2021/07/08 19:08:03 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.275 2021/07/09 06:37:11 rillig Exp $"); #endif #include @@ -2012,9 +2012,9 @@ gcc_attribute_list: /* https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html */ gcc_attribute: T_ATTRIBUTE T_LPAREN T_LPAREN { - attron = true; + attron = true; } gcc_attribute_spec_list { - attron = false; + attron = false; } T_RPAREN T_RPAREN ;