Module Name:    src
Committed By:   rillig
Date:           Sun Sep 26 18:52:16 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: declarations.0.stdout
        src/usr.bin/indent: indent.c

Log Message:
indent: fix missing space between comma and ellipsis

According to lint's C grammar, in standard C an ellipsis only occurs
after a comma. There are GCC extensions that allow an ellipsis as the
only function parameter, as well as in 'case a ... b', but these are
rare.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/declarations.0.stdout
cvs rdiff -u -r1.84 -r1.85 src/usr.bin/indent/indent.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/declarations.0.stdout
diff -u src/tests/usr.bin/indent/declarations.0.stdout:1.3 src/tests/usr.bin/indent/declarations.0.stdout:1.4
--- src/tests/usr.bin/indent/declarations.0.stdout:1.3	Sun Sep 26 18:42:46 2021
+++ src/tests/usr.bin/indent/declarations.0.stdout	Sun Sep 26 18:52:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: declarations.0.stdout,v 1.3 2021/09/26 18:42:46 rillig Exp $	*/
+/*	$NetBSD: declarations.0.stdout,v 1.4 2021/09/26 18:52:16 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/declarations.0.stdout 334480 2018-06-01 09:58:44Z pstef $ */
 /* See r303570 */
 
@@ -55,7 +55,7 @@ int_create(void)
 static
 _attribute_printf(1, 2)
 void
-print_error(const char *fmt,...)
+print_error(const char *fmt, ...)
 {
 
 }
@@ -124,7 +124,6 @@ struct s01 {
 };
 
 int
-/* $ FIXME: There must be a space before the ellipsis. */
-my_printf(const char *fmt,...)
+my_printf(const char *fmt, ...)
 {
 }

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.84 src/usr.bin/indent/indent.c:1.85
--- src/usr.bin/indent/indent.c:1.84	Sat Sep 25 22:57:04 2021
+++ src/usr.bin/indent/indent.c	Sun Sep 26 18:52:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.84 2021/09/25 22:57:04 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 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.84 2021/09/25 22:57:04 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1028,6 +1028,8 @@ process_string_prefix(void)
 static void
 process_period(void)
 {
+    if (code.e[-1] == ',')
+	*code.e++ = ' ';
     *code.e++ = '.';		/* move the period into line */
     ps.want_blank = false;	/* dont put a blank after a period */
 }

Reply via email to