Module Name: src Committed By: rillig Date: Wed Jun 14 14:11:28 UTC 2023
Modified Files: src/tests/usr.bin/indent: lsym_lparen_or_lbracket.c opt_bc.c opt_pcs.c src/usr.bin/indent: debug.c indent.c indent.h io.c lexi.c pr_comment.c Log Message: indent: allow more than 20 nested parentheses or brackets To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c \ src/tests/usr.bin/indent/opt_pcs.c cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/opt_bc.c cvs rdiff -u -r1.58 -r1.59 src/usr.bin/indent/debug.c cvs rdiff -u -r1.363 -r1.364 src/usr.bin/indent/indent.c cvs rdiff -u -r1.193 -r1.194 src/usr.bin/indent/indent.h cvs rdiff -u -r1.219 -r1.220 src/usr.bin/indent/io.c cvs rdiff -u -r1.227 -r1.228 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.164 -r1.165 src/usr.bin/indent/pr_comment.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/lsym_lparen_or_lbracket.c diff -u src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.16 src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.17 --- src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c:1.16 Sat Jun 10 08:17:04 2023 +++ src/tests/usr.bin/indent/lsym_lparen_or_lbracket.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.16 2023/06/10 08:17:04 rillig Exp $ */ +/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.17 2023/06/14 14:11:28 rillig Exp $ */ /* * Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '[' @@ -144,9 +144,9 @@ function(void) //indent run-equals-input -/* This is the maximum supported number of parentheses. */ //indent input int zero = (((((((((((((((((((0))))))))))))))))))); +int many = ((((((((((((((((((((((((((((((((0)))))))))))))))))))))))))))))))); //indent end //indent run-equals-input -di0 Index: src/tests/usr.bin/indent/opt_pcs.c diff -u src/tests/usr.bin/indent/opt_pcs.c:1.16 src/tests/usr.bin/indent/opt_pcs.c:1.17 --- src/tests/usr.bin/indent/opt_pcs.c:1.16 Thu May 18 08:09:28 2023 +++ src/tests/usr.bin/indent/opt_pcs.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_pcs.c,v 1.16 2023/05/18 08:09:28 rillig Exp $ */ +/* $NetBSD: opt_pcs.c,v 1.17 2023/06/14 14:11:28 rillig Exp $ */ /* * Tests for the options '-pcs' and '-npcs'. @@ -114,6 +114,8 @@ int offset = offsetof(struct s, member); //indent input int unary = +call(); +// $ FIXME: Unusual, but there should be no space. +int postfix = step++ (); int binary = 1 + call(); //indent end @@ -121,5 +123,6 @@ int binary = 1 + call(); //indent run -pcs -di0 int unary = +call (); +int postfix = step++ (); int binary = 1 + call (); //indent end Index: src/tests/usr.bin/indent/opt_bc.c diff -u src/tests/usr.bin/indent/opt_bc.c:1.10 src/tests/usr.bin/indent/opt_bc.c:1.11 --- src/tests/usr.bin/indent/opt_bc.c:1.10 Sat Jun 10 06:52:35 2023 +++ src/tests/usr.bin/indent/opt_bc.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_bc.c,v 1.10 2023/06/10 06:52:35 rillig Exp $ */ +/* $NetBSD: opt_bc.c,v 1.11 2023/06/14 14:11:28 rillig Exp $ */ /* * Tests for the options '-bc' and '-nbc'. @@ -119,3 +119,22 @@ int a = 1, int a = (1), b = 2; //indent end + + +/* + * When declarations are too long to fit in a single line, they should not be + * joined. + */ +//indent input +{ + const struct paren_level *prev = state.prev_ps.paren.item, + *curr = ps.paren.item; +} +//indent end + +//indent run +// $ FIXME: The line becomes too long. +{ + const struct paren_level *prev = state.prev_ps.paren.item, *curr = ps.paren.item; +} +//indent end Index: src/usr.bin/indent/debug.c diff -u src/usr.bin/indent/debug.c:1.58 src/usr.bin/indent/debug.c:1.59 --- src/usr.bin/indent/debug.c:1.58 Wed Jun 14 09:57:02 2023 +++ src/usr.bin/indent/debug.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.58 2023/06/14 09:57:02 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.59 2023/06/14 14:11:28 rillig Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: debug.c,v 1.58 2023/06/14 09:57:02 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.59 2023/06/14 14:11:28 rillig Exp $"); #include <stdarg.h> #include <string.h> @@ -255,15 +255,14 @@ debug_ps_enum_member(const char *name, c } static bool -ps_paren_has_changed(void) +paren_stack_equal(const struct paren_stack *a, const struct paren_stack *b) { - if (state.prev_ps.nparen != ps.nparen) - return true; + if (a->len != b->len) + return false; - const struct paren_level *prev = state.prev_ps.paren, *curr = ps.paren; - for (int i = 0; i < ps.nparen; i++) - if (curr[i].indent != prev[i].indent - || curr[i].cast != prev[i].cast) + for (size_t i = 0, n = a->len; i < n; i++) + if (a->item[i].indent != b->item[i].indent + || a->item[i].cast != b->item[i].cast) return true; return false; } @@ -271,17 +270,18 @@ ps_paren_has_changed(void) static void debug_ps_paren(void) { - if (!config.full_parser_state && !ps_paren_has_changed() + if (!config.full_parser_state + && paren_stack_equal(&state.prev_ps.paren, &ps.paren) && !state.ps_first) return; debug_printf(" ps.paren:"); - for (int i = 0; i < ps.nparen; i++) { + for (size_t i = 0; i < ps.paren.len; i++) { debug_printf(" %s%d", - paren_level_cast_name[ps.paren[i].cast], - ps.paren[i].indent); + paren_level_cast_name[ps.paren.item[i].cast], + ps.paren.item[i].indent); } - if (ps.nparen == 0) + if (ps.paren.len == 0) debug_printf(" none"); debug_println(""); } @@ -358,7 +358,6 @@ debug_parser_state(void) debug_ps_bool(next_unary); debug_ps_bool(want_blank); debug_ps_int(ind_paren_level); - debug_ps_int(nparen); debug_ps_paren(); state.heading = "indentation of comments"; Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.363 src/usr.bin/indent/indent.c:1.364 --- src/usr.bin/indent/indent.c:1.363 Wed Jun 14 13:15:30 2023 +++ src/usr.bin/indent/indent.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.363 2023/06/14 13:15:30 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.364 2023/06/14 14:11:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: indent.c,v 1.363 2023/06/14 13:15:30 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.364 2023/06/14 14:11:28 rillig Exp $"); #include <sys/param.h> #include <err.h> @@ -444,6 +444,49 @@ read_preprocessing_line(void) } static void +paren_stack_push(struct paren_stack *s, int indent, enum paren_level_cast cast) +{ + if (s->len == s->cap) { + s->cap = 10 + s->cap; + s->item = nonnull(realloc(s->item, + sizeof(s->item[0]) * s->cap)); + } + s->item[s->len++] = (struct paren_level){indent, cast}; +} + +static void +parser_state_backup(struct parser_state *dst) +{ + *dst = ps; + + dst->paren.item = nonnull( + malloc(sizeof(dst->paren.item[0]) * ps.paren.cap)); + dst->paren.len = ps.paren.len; + dst->paren.cap = ps.paren.cap; + memcpy(dst->paren.item, ps.paren.item, + sizeof(dst->paren.item[0]) * ps.paren.len); +} + +static void +parser_state_restore(const struct parser_state *src) +{ + struct paren_stack dst_paren = ps.paren; + ps = *src; + ps.paren = dst_paren; + + ps.paren.len = 0; + for (size_t i = 0; i < src->paren.len; i++) + paren_stack_push(&ps.paren, + src->paren.item[i].indent, src->paren.item[i].cast); +} + +static void +parser_state_free(struct parser_state *pst) +{ + free(pst->paren.item); +} + +static void process_preprocessing(void) { if (lab.len > 0 || code.len > 0 || com.len > 0) @@ -464,20 +507,20 @@ process_preprocessing(void) ifdef.item = nonnull(realloc(ifdef.item, sizeof(ifdef.item[0]) * ifdef.cap)); } - ifdef.item[ifdef.len++] = ps; + parser_state_backup(ifdef.item + ifdef.len++); out.line_kind = lk_if; } else if (dir_len >= 2 && memcmp(dir, "el", 2) == 0) { if (ifdef.len == 0) diag(1, "Unmatched #%.*s", (int)dir_len, dir); else - ps = ifdef.item[ifdef.len - 1]; + parser_state_restore(ifdef.item + ifdef.len - 1); } else if (dir_len == 5 && memcmp(dir, "endif", 5) == 0) { if (ifdef.len == 0) diag(1, "Unmatched #endif"); else - ifdef.len--; + parser_state_free(ifdef.item + --ifdef.len); out.line_kind = lk_endif; } } @@ -486,7 +529,7 @@ static void process_newline(void) { if (ps.prev_lsym == lsym_comma - && ps.nparen == 0 && !ps.in_init + && ps.paren.len == 0 && !ps.in_init && !opt.break_after_comma && ps.break_after_comma && lab.len == 0 /* for preprocessing lines */ && com.len == 0) @@ -507,8 +550,6 @@ stay_in_line: static bool want_blank_before_lparen(void) { - if (!ps.want_blank) - return false; if (opt.proc_calls_space) return true; if (ps.prev_lsym == lsym_rparen || ps.prev_lsym == lsym_rbracket) @@ -523,24 +564,12 @@ want_blank_before_lparen(void) } static void -ps_paren_push(int indent, enum paren_level_cast cast) -{ - if (++ps.nparen == array_length(ps.paren)) { - diag(0, "Reached internal limit of %zu unclosed parentheses", - array_length(ps.paren)); - ps.nparen--; - } - ps.paren[ps.nparen - 1].indent = indent; - ps.paren[ps.nparen - 1].cast = cast; -} - -static void process_lparen(void) { if (is_function_pointer_declaration()) indent_declarator(ps.decl_ind, ps.tabs_to_var); - else if (want_blank_before_lparen()) + else if (ps.want_blank && want_blank_before_lparen()) buf_add_char(&code, ' '); ps.want_blank = false; buf_add_char(&code, token.s[0]); @@ -553,8 +582,6 @@ process_lparen(void) ps.in_var_decl = false; } - int indent = ind_add(0, code.s, code.len); - enum paren_level_cast cast = cast_unknown; if (ps.prev_lsym == lsym_offsetof || ps.prev_lsym == lsym_sizeof @@ -565,20 +592,18 @@ process_lparen(void) || ps.line_has_func_def) cast = cast_no; - ps_paren_push(indent, cast); - debug_println("paren_indents[%d] is now %s%d", - ps.nparen - 1, paren_level_cast_name[cast], indent); + paren_stack_push(&ps.paren, ind_add(0, code.s, code.len), cast); } static void process_rparen(void) { - if (ps.nparen == 0) { + if (ps.paren.len == 0) { diag(0, "Extra '%c'", *token.s); goto unbalanced; } - enum paren_level_cast cast = ps.paren[--ps.nparen].cast; + enum paren_level_cast cast = ps.paren.item[--ps.paren.len].cast; if (ps.in_func_def_params || (ps.line_has_decl && !ps.in_init)) cast = cast_no; @@ -590,12 +615,12 @@ process_rparen(void) ps.want_blank = true; if (code.len == 0) - ps.ind_paren_level = ps.nparen; + ps.ind_paren_level = (int)ps.paren.len; unbalanced: buf_add_char(&code, token.s[0]); - if (ps.spaced_expr_psym != psym_0 && ps.nparen == 0) { + if (ps.spaced_expr_psym != psym_0 && ps.paren.len == 0) { if (ps.extra_expr_indent == eei_maybe) ps.extra_expr_indent = eei_last; ps.force_nl = true; @@ -617,23 +642,21 @@ process_lbracket(void) ps.want_blank = false; buf_add_char(&code, token.s[0]); - int indent = ind_add(0, code.s, code.len); - ps_paren_push(indent, cast_no); - debug_println("paren_indents[%d] is now %d", ps.nparen - 1, indent); + paren_stack_push(&ps.paren, ind_add(0, code.s, code.len), cast_no); } static void process_rbracket(void) { - if (ps.nparen == 0) { + if (ps.paren.len == 0) { diag(0, "Extra '%c'", *token.s); goto unbalanced; } - --ps.nparen; + ps.paren.len--; ps.want_blank = true; if (code.len == 0) - ps.ind_paren_level = ps.nparen; + ps.ind_paren_level = (int)ps.paren.len; unbalanced: buf_add_char(&code, token.s[0]); @@ -670,9 +693,9 @@ process_lbrace(void) } } - if (ps.nparen > 0 && ps.init_level == 0) { + if (ps.paren.len > 0 && ps.init_level == 0) { diag(1, "Unbalanced parentheses"); - ps.nparen = 0; + ps.paren.len = 0; if (ps.spaced_expr_psym != psym_0) { parse(ps.spaced_expr_psym); ps.spaced_expr_psym = psym_0; @@ -711,9 +734,9 @@ process_lbrace(void) static void process_rbrace(void) { - if (ps.nparen > 0 && ps.init_level == 0) { + if (ps.paren.len > 0 && ps.init_level == 0) { diag(1, "Unbalanced parentheses"); - ps.nparen = 0; + ps.paren.len = 0; ps.spaced_expr_psym = psym_0; } @@ -797,7 +820,7 @@ process_comma(void) buf_add_char(&code, ','); - if (ps.nparen == 0) { + if (ps.paren.len == 0) { if (ps.init_level == 0) ps.in_init = false; int typical_varname_length = 8; @@ -855,12 +878,12 @@ process_semicolon(void) * structure declaration before, we * aren't anymore */ - if (ps.nparen > 0 && ps.spaced_expr_psym != psym_for_exprs) { + if (ps.paren.len > 0 && ps.spaced_expr_psym != psym_for_exprs) { /* There were unbalanced parentheses in the statement. It is a * bit complicated, because the semicolon might be in a for * statement. */ diag(1, "Unbalanced parentheses"); - ps.nparen = 0; + ps.paren.len = 0; if (ps.spaced_expr_psym != psym_0) { parse(ps.spaced_expr_psym); ps.spaced_expr_psym = psym_0; @@ -868,7 +891,7 @@ process_semicolon(void) } buf_add_char(&code, ';'); ps.want_blank = true; - ps.in_stmt_or_decl = ps.nparen > 0; + ps.in_stmt_or_decl = ps.paren.len > 0; ps.decl_ind = 0; if (ps.spaced_expr_psym == psym_0) { @@ -925,7 +948,7 @@ process_word(lexer_symbol lsym) ps.want_blank = false; } - } else if (ps.spaced_expr_psym != psym_0 && ps.nparen == 0) { + } else if (ps.spaced_expr_psym != psym_0 && ps.paren.len == 0) { ps.force_nl = true; ps.in_stmt_or_decl = false; ps.next_unary = true; @@ -997,7 +1020,7 @@ process_lsym(lexer_symbol lsym) /* INDENT ON */ case lsym_tag: - if (ps.nparen > 0) + if (ps.paren.len > 0) goto copy_token; /* FALLTHROUGH */ case lsym_type_outside_parentheses: Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.193 src/usr.bin/indent/indent.h:1.194 --- src/usr.bin/indent/indent.h:1.193 Wed Jun 14 09:57:02 2023 +++ src/usr.bin/indent/indent.h Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.193 2023/06/14 09:57:02 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.194 2023/06/14 14:11:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -370,11 +370,14 @@ extern struct parser_state { int ind_paren_level; /* the number of parentheses or brackets that * is used for indenting a continuation line of * a declaration, initializer or statement */ - int nparen; /* the number of parentheses or brackets that - * are currently open; used to indent the - * remaining lines of the statement, - * initializer or declaration */ - struct paren_level paren[20]; + struct paren_stack { + struct paren_level *item; + size_t len; + size_t cap; + } paren; /* the parentheses or brackets that are + * currently open; used to indent the remaining + * lines of the statement, initializer or + * declaration */ /* Indentation of comments */ Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.219 src/usr.bin/indent/io.c:1.220 --- src/usr.bin/indent/io.c:1.219 Wed Jun 14 09:57:02 2023 +++ src/usr.bin/indent/io.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.219 2023/06/14 09:57:02 rillig Exp $ */ +/* $NetBSD: io.c,v 1.220 2023/06/14 14:11:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: io.c,v 1.219 2023/06/14 09:57:02 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.220 2023/06/14 14:11:28 rillig Exp $"); #include <stdio.h> @@ -276,14 +276,16 @@ static void output_line_code(void) { int target_ind = compute_code_indent(); - for (int i = 0; i < ps.nparen; i++) { - int paren_ind = ps.paren[i].indent; + for (size_t i = 0; i < ps.paren.len; i++) { + int paren_ind = ps.paren.item[i].indent; if (paren_ind >= 0) { - ps.paren[i].indent = -1 - (paren_ind + target_ind); + ps.paren.item[i].indent = + -1 - (paren_ind + target_ind); debug_println( - "setting paren_indents[%d] from %d to %d " + "setting paren_indents[%zu] from %d to %d " "for column %d", - i, paren_ind, ps.paren[i].indent, target_ind + 1); + i, paren_ind, + ps.paren.item[i].indent, target_ind + 1); } } @@ -399,14 +401,14 @@ output_line(void) if (ps.extra_expr_indent == eei_last) ps.extra_expr_indent = eei_no; if (!(ps.psyms.sym[ps.psyms.top] == psym_if_expr_stmt_else - && ps.nparen > 0)) + && ps.paren.len > 0)) ps.ind_level = ps.ind_level_follow; - ps.ind_paren_level = ps.nparen; + ps.ind_paren_level = (int)ps.paren.len; ps.want_blank = false; - if (ps.nparen > 0) { + if (ps.paren.len > 0) { /* TODO: explain what negative indentation means */ - paren_indent = -1 - ps.paren[ps.nparen - 1].indent; + paren_indent = -1 - ps.paren.item[ps.paren.len - 1].indent; debug_println("paren_indent is now %d", paren_indent); } Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.227 src/usr.bin/indent/lexi.c:1.228 --- src/usr.bin/indent/lexi.c:1.227 Wed Jun 14 08:36:51 2023 +++ src/usr.bin/indent/lexi.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.227 2023/06/14 08:36:51 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.228 2023/06/14 14:11:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: lexi.c,v 1.227 2023/06/14 08:36:51 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.228 2023/06/14 14:11:28 rillig Exp $"); #include <stdlib.h> #include <string.h> @@ -397,7 +397,7 @@ lexi_alnum(void) ps.next_unary = ps.prev_lsym == lsym_tag || ps.prev_lsym == lsym_typedef; - if (ps.prev_lsym == lsym_tag && ps.nparen == 0) + if (ps.prev_lsym == lsym_tag && ps.paren.len == 0) return lsym_type_outside_parentheses; token_add_char('\0'); @@ -418,17 +418,19 @@ lexi_alnum(void) lsym = lsym_type_in_parentheses; ps.next_unary = true; found_typename: - if (ps.nparen > 0) { + if (ps.paren.len > 0) { /* inside parentheses: cast, param list, offsetof or * sizeof */ - if (ps.paren[ps.nparen - 1].cast == cast_unknown) - ps.paren[ps.nparen - 1].cast = cast_maybe; + struct paren_level *paren_level = + ps.paren.item + ps.paren.len - 1; + if (paren_level->cast == cast_unknown) + paren_level->cast = cast_maybe; } if (ps.prev_lsym != lsym_period && ps.prev_lsym != lsym_unary_op) { if (kw != NULL && kw->lsym == lsym_tag) return lsym_tag; - if (ps.nparen == 0) + if (ps.paren.len == 0) return lsym_type_outside_parentheses; } } @@ -436,14 +438,14 @@ found_typename: if (inp_p[0] == '(' && ps.psyms.top <= 1 && ps.ind_level == 0 && !ps.in_func_def_params && !ps.in_init) { - if (ps.nparen == 0 && probably_function_definition()) { + if (ps.paren.len == 0 && probably_function_definition()) { ps.line_has_func_def = true; if (ps.in_decl) ps.in_func_def_params = true; return lsym_funcname; } - } else if (ps.nparen == 0 && probably_typename()) { + } else if (ps.paren.len == 0 && probably_typename()) { ps.next_unary = true; return lsym_type_outside_parentheses; } @@ -462,7 +464,7 @@ is_asterisk_pointer(void) ps.prev_lsym == lsym_rparen || ps.prev_lsym == lsym_rbracket) return false; - return ps.in_decl && ps.nparen > 0; + return ps.in_decl && ps.paren.len > 0; } static bool Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.164 src/usr.bin/indent/pr_comment.c:1.165 --- src/usr.bin/indent/pr_comment.c:1.164 Wed Jun 14 09:31:05 2023 +++ src/usr.bin/indent/pr_comment.c Wed Jun 14 14:11:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.164 2023/06/14 09:31:05 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.165 2023/06/14 14:11:28 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pr_comment.c,v 1.164 2023/06/14 09:31:05 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.165 2023/06/14 14:11:28 rillig Exp $"); #include <string.h> @@ -283,7 +283,7 @@ copy_comment_wrap(int line_length, bool if (had_eof) goto unterminated_comment; if (!copy_comment_wrap_newline(&last_blank, - seen_newline)) + seen_newline)) break; seen_newline = true; } else if (inp_p[0] == '*' && inp_p[1] == '/')