Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: remove redundant assignment



details:   https://anonhg.NetBSD.org/src/rev/9bf7148f0f2d
branches:  trunk
changeset: 991090:9bf7148f0f2d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 07 10:42:58 2021 +0000

description:
indent: remove redundant assignment

At that point, ps.next_col_1 is already false.

No functional change.

diffstat:

 tests/usr.bin/indent/t_errors.sh |  20 ++++++++++++++++----
 usr.bin/indent/pr_comment.c      |   5 ++---
 2 files changed, 18 insertions(+), 7 deletions(-)

diffs (75 lines):

diff -r ff6a9141878b -r 9bf7148f0f2d tests/usr.bin/indent/t_errors.sh
--- a/tests/usr.bin/indent/t_errors.sh  Sun Nov 07 10:34:03 2021 +0000
+++ b/tests/usr.bin/indent/t_errors.sh  Sun Nov 07 10:42:58 2021 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_errors.sh,v 1.17 2021/10/30 16:57:18 rillig Exp $
+# $NetBSD: t_errors.sh,v 1.18 2021/11/07 10:42:58 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -174,8 +174,8 @@
            -U
 }
 
-atf_test_case 'unterminated_comment'
-unterminated_comment_body()
+atf_test_case 'unterminated_comment_wrap'
+unterminated_comment_wrap_body()
 {
        echo '/*' > comment.c
 
@@ -185,6 +185,17 @@
            "$indent" -st < comment.c
 }
 
+atf_test_case 'unterminated_comment_nowrap'
+unterminated_comment_nowrap_body()
+{
+       echo '/*-' > comment.c
+
+       atf_check -s 'exit:1' \
+           -o 'inline:/*-'"$nl$nl" \
+           -e 'inline:error: Standard Input:2: Unterminated comment'"$nl" \
+           "$indent" -st < comment.c
+}
+
 atf_test_case 'in_place_wrong_backup'
 in_place_wrong_backup_body()
 {
@@ -479,7 +490,8 @@
        atf_add_test_case 'option_int_trailing_garbage'
        atf_add_test_case 'option_cli_trailing_garbage'
        atf_add_test_case 'option_indent_size_zero'
-       atf_add_test_case 'unterminated_comment'
+       atf_add_test_case 'unterminated_comment_wrap'
+       atf_add_test_case 'unterminated_comment_nowrap'
        atf_add_test_case 'in_place_wrong_backup'
        atf_add_test_case 'argument_input_enoent'
        atf_add_test_case 'argument_output_equals_input_name'
diff -r ff6a9141878b -r 9bf7148f0f2d usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sun Nov 07 10:34:03 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sun Nov 07 10:42:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.107 2021/11/07 10:34:03 rillig Exp $  */
+/*     $NetBSD: pr_comment.c,v 1.108 2021/11/07 10:42:58 rillig Exp $  */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.107 2021/11/07 10:34:03 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.108 2021/11/07 10:42:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -358,7 +358,6 @@
 
 finish:
     com_terminate();
-    ps.next_col_1 = false;
 }
 
 /*



Home | Main Index | Thread Index | Old Index