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: fix missing space between comma and e...



details:   https://anonhg.NetBSD.org/src/rev/2655de9186c7
branches:  trunk
changeset: 987445:2655de9186c7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 26 18:52:16 2021 +0000

description:
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.

diffstat:

 tests/usr.bin/indent/declarations.0.stdout |  7 +++----
 usr.bin/indent/indent.c                    |  6 ++++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 8444040e9b54 -r 2655de9186c7 tests/usr.bin/indent/declarations.0.stdout
--- a/tests/usr.bin/indent/declarations.0.stdout        Sun Sep 26 18:42:46 2021 +0000
+++ b/tests/usr.bin/indent/declarations.0.stdout        Sun Sep 26 18:52:16 2021 +0000
@@ -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 @@
 static
 _attribute_printf(1, 2)
 void
-print_error(const char *fmt,...)
+print_error(const char *fmt, ...)
 {
 
 }
@@ -124,7 +124,6 @@
 };
 
 int
-/* $ FIXME: There must be a space before the ellipsis. */
-my_printf(const char *fmt,...)
+my_printf(const char *fmt, ...)
 {
 }
diff -r 8444040e9b54 -r 2655de9186c7 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sun Sep 26 18:42:46 2021 +0000
+++ b/usr.bin/indent/indent.c   Sun Sep 26 18:52:16 2021 +0000
@@ -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 @@
 
 #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 @@
 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 */
 }



Home | Main Index | Thread Index | Old Index