mirror of
https://github.com/postgres/postgres.git
synced 2026-06-21 16:11:13 -04:00
Make pg_bsd_indent add a space between comma and period.
Formatting of variadic functions and struct literals with named fields used to be ugly due to pg_bsd_indent treating period as always being a binary operator. After a comma, it's not that, so insert a space. Bump pg_bsd_indent's version so that people who use out-of-tree copies will know they need to update. (This also covers the other pg_bsd_indent behavioral change introduced in a3e6beba6.) Author: Andreas Karlsson <andreas@proxel.se> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/c3327be8-09e2-46a1-88b4-228a339d6916@proxel.se
This commit is contained in:
@@ -51,7 +51,7 @@ static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93";
|
||||
#include "indent_globs.h"
|
||||
#include "indent.h"
|
||||
|
||||
#define INDENT_VERSION "2.1.2"
|
||||
#define INDENT_VERSION "2.1.3"
|
||||
|
||||
/* profile types */
|
||||
#define PRO_SPECIAL 1 /* special case */
|
||||
|
||||
@@ -1013,6 +1013,8 @@ check_type:
|
||||
|
||||
case period: /* treat a period kind of like a binary
|
||||
* operation */
|
||||
if (ps.want_blank && ps.last_token == comma)
|
||||
*e_code++ = ' ';
|
||||
*e_code++ = '.'; /* move the period into line */
|
||||
ps.want_blank = false; /* don't put a blank after a period */
|
||||
break;
|
||||
|
||||
@@ -54,7 +54,7 @@ int_create(void)
|
||||
static
|
||||
_attribute_printf(1, 2)
|
||||
void
|
||||
print_error(const char *fmt,...)
|
||||
print_error(const char *fmt, ...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -19,3 +19,5 @@ void u(struct x a) {
|
||||
int b;
|
||||
struct y c = (struct y *)&a;
|
||||
}
|
||||
|
||||
static struct foo f = { .a = 1,.b=2 };
|
||||
|
||||
@@ -21,3 +21,5 @@ u(struct x a)
|
||||
int b;
|
||||
struct y c = (struct y *)&a;
|
||||
}
|
||||
|
||||
static struct foo f = {.a = 1, .b = 2};
|
||||
|
||||
@@ -35,7 +35,7 @@ my $bak_to_cleanup;
|
||||
END { unlink $bak_to_cleanup if defined $bak_to_cleanup; }
|
||||
|
||||
# Update for pg_bsd_indent version
|
||||
my $INDENT_VERSION = "2.1.2";
|
||||
my $INDENT_VERSION = "2.1.3";
|
||||
|
||||
# Our standard indent settings
|
||||
my $indent_opts =
|
||||
|
||||
Reference in New Issue
Block a user