Module Name: src Committed By: rillig Date: Fri Oct 29 16:54:52 UTC 2021
Modified Files: src/tests/usr.bin/indent: t_errors.sh t_misc.sh token_lparen.c src/usr.bin/indent: indent.c indent.h lexi.c Log Message: indent: spell 'parentheses' properly in messages and comments To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/t_errors.sh cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/t_misc.sh cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/token_lparen.c cvs rdiff -u -r1.167 -r1.168 src/usr.bin/indent/indent.c cvs rdiff -u -r1.55 -r1.56 src/usr.bin/indent/indent.h cvs rdiff -u -r1.107 -r1.108 src/usr.bin/indent/lexi.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/indent/t_errors.sh diff -u src/tests/usr.bin/indent/t_errors.sh:1.10 src/tests/usr.bin/indent/t_errors.sh:1.11 --- src/tests/usr.bin/indent/t_errors.sh:1.10 Fri Oct 29 16:49:46 2021 +++ src/tests/usr.bin/indent/t_errors.sh Fri Oct 29 16:54:51 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_errors.sh,v 1.10 2021/10/29 16:49:46 rillig Exp $ +# $NetBSD: t_errors.sh,v 1.11 2021/10/29 16:54:51 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -358,8 +358,8 @@ unbalanced_parentheses_1_body() ; EOF cat <<-\EOF > stderr.exp - error: code.c:3: Unbalanced parens - warning: code.c:4: Extra ) + error: code.c:3: Unbalanced parentheses + warning: code.c:4: Extra ')' EOF atf_check -s 'exit:1' -e 'file:stderr.exp' \ @@ -380,8 +380,8 @@ unbalanced_parentheses_2_body() ; EOF cat <<-\EOF > stderr.exp - error: code.c:3: Unbalanced parens - warning: code.c:6: Extra ) + error: code.c:3: Unbalanced parentheses + warning: code.c:6: Extra ')' EOF atf_check -s 'exit:1' -e 'file:stderr.exp' \ @@ -400,7 +400,7 @@ unbalanced_parentheses_3_body() ; EOF cat <<-\EOF > stderr.exp - error: code.c:4: Unbalanced parens + error: code.c:4: Unbalanced parentheses error: code.c:4: Statement nesting error EOF Index: src/tests/usr.bin/indent/t_misc.sh diff -u src/tests/usr.bin/indent/t_misc.sh:1.9 src/tests/usr.bin/indent/t_misc.sh:1.10 --- src/tests/usr.bin/indent/t_misc.sh:1.9 Thu Oct 28 21:02:05 2021 +++ src/tests/usr.bin/indent/t_misc.sh Fri Oct 29 16:54:51 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_misc.sh,v 1.9 2021/10/28 21:02:05 rillig Exp $ +# $NetBSD: t_misc.sh,v 1.10 2021/10/29 16:54:51 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -316,7 +316,7 @@ line_no_counting_body() EOF cat <<-\EOF > code.err - warning: code.c:3: Extra ) + warning: code.c:3: Extra ')' EOF atf_check -o 'ignore' -e 'file:code.err' \ Index: src/tests/usr.bin/indent/token_lparen.c diff -u src/tests/usr.bin/indent/token_lparen.c:1.7 src/tests/usr.bin/indent/token_lparen.c:1.8 --- src/tests/usr.bin/indent/token_lparen.c:1.7 Mon Oct 25 20:16:16 2021 +++ src/tests/usr.bin/indent/token_lparen.c Fri Oct 29 16:54:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: token_lparen.c,v 1.7 2021/10/25 20:16:16 rillig Exp $ */ +/* $NetBSD: token_lparen.c,v 1.8 2021/10/29 16:54:51 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -52,7 +52,7 @@ function(void) /* GCC statement expression */ /* expr = ({if(expr)debug();expr;}); */ -/* $ XXX: Generates wrong 'error: Standard Input:36: Unbalanced parens'. */ +/* $ XXX: Generates 'error: Standard Input:36: Unbalanced parentheses'. */ } #indent end Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.167 src/usr.bin/indent/indent.c:1.168 --- src/usr.bin/indent/indent.c:1.167 Thu Oct 28 22:20:08 2021 +++ src/usr.bin/indent/indent.c Fri Oct 29 16:54:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.167 2021/10/28 22:20:08 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.168 2021/10/29 16:54:51 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.167 2021/10/28 22:20:08 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.168 2021/10/29 16:54:51 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -722,7 +722,7 @@ static void process_lparen_or_lbracket(int decl_ind, bool tabs_to_var, bool spaced_expr) { if (++ps.p_l_follow == array_length(ps.paren_indents)) { - diag(0, "Reached internal limit of %zu unclosed parens", + diag(0, "Reached internal limit of %zu unclosed parentheses", array_length(ps.paren_indents)); ps.p_l_follow--; } @@ -776,7 +776,7 @@ process_rparen_or_rbracket(bool *spaced_ if (--ps.p_l_follow < 0) { ps.p_l_follow = 0; - diag(0, "Extra %c", *token.s); + diag(0, "Extra '%c'", *token.s); } if (code.e == code.s) /* if the paren starts the line */ @@ -903,10 +903,10 @@ process_semicolon(bool *seen_case, int * if ((!*spaced_expr || hd != hd_for) && ps.p_l_follow > 0) { /* - * There were unbalanced parens in the statement. It is a bit + * There were unbalanced parentheses in the statement. It is a bit * complicated, because the semicolon might be in a for statement. */ - diag(1, "Unbalanced parens"); + diag(1, "Unbalanced parentheses"); ps.p_l_follow = 0; if (*spaced_expr) { /* 'if', 'while', etc. */ *spaced_expr = false; @@ -956,8 +956,8 @@ process_lbrace(bool *force_nl, bool *spa if (ps.in_parameter_declaration) blank_line_before = false; - if (ps.p_l_follow > 0) { /* check for preceding unbalanced parens */ - diag(1, "Unbalanced parens"); + if (ps.p_l_follow > 0) { + diag(1, "Unbalanced parentheses"); ps.p_l_follow = 0; if (*spaced_expr) { /* check for unclosed 'if', 'for', etc. */ *spaced_expr = false; @@ -1003,7 +1003,7 @@ process_rbrace(bool *spaced_expr, int *d } if (ps.p_l_follow != 0) { /* check for unclosed if, for, else. */ - diag(1, "Unbalanced parens"); + diag(1, "Unbalanced parentheses"); ps.p_l_follow = 0; *spaced_expr = false; } Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.55 src/usr.bin/indent/indent.h:1.56 --- src/usr.bin/indent/indent.h:1.55 Thu Oct 28 22:20:08 2021 +++ src/usr.bin/indent/indent.h Fri Oct 29 16:54:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.55 2021/10/28 22:20:08 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.56 2021/10/29 16:54:51 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -261,8 +261,8 @@ extern bool found_err; extern int blank_lines_to_output; extern bool blank_line_before; extern bool blank_line_after; -extern bool break_comma; /* when true and not in parens, break after a - * comma */ +extern bool break_comma; /* when true and not in parentheses, break + * after a comma */ extern float case_ind; /* indentation level to be used for a "case * n:" */ extern bool had_eof; /* whether input is exhausted */ @@ -286,10 +286,11 @@ extern struct parser_state { * before the start of a box comment so that * forthcoming lines of the comment are * indented properly */ - int cast_mask; /* indicates which close parens potentially - * close off casts */ - int not_cast_mask; /* indicates which close parens definitely - * close off something else than casts */ + int cast_mask; /* indicates which close parentheses + * potentially close off casts */ + int not_cast_mask; /* indicates which close parentheses + * definitely close off something else than + * casts */ bool block_init; /* whether inside a block initialization */ int block_init_level; /* The level of brace nesting in an * initialization */ Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.107 src/usr.bin/indent/lexi.c:1.108 --- src/usr.bin/indent/lexi.c:1.107 Thu Oct 28 22:06:23 2021 +++ src/usr.bin/indent/lexi.c Fri Oct 29 16:54:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.107 2021/10/28 22:06:23 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.108 2021/10/29 16:54:51 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include <sys/cdefs.h> #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.107 2021/10/28 22:06:23 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.108 2021/10/29 16:54:51 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -488,7 +488,7 @@ lexi_alnum(void) case kw_type: found_typename: if (ps.p_l_follow != 0) { - /* inside parens: cast, param list, offsetof or sizeof */ + /* inside parentheses: cast, param list, offsetof or sizeof */ ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.not_cast_mask; } if (ps.last_token == lsym_period ||