1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Phase 3 of pgindent updates.

Don't move parenthesized lines to the left, even if that means they
flow past the right margin.

By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis.  However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent.  That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.

This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.

This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.

Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@@ -147,14 +147,14 @@ static Expr *inline_function(Oid funcid, Oid result_type, Oid result_collid,
static Node *substitute_actual_parameters(Node *expr, int nargs, List *args,
int *usecounts);
static Node *substitute_actual_parameters_mutator(Node *node,
substitute_actual_parameters_context *context);
substitute_actual_parameters_context *context);
static void sql_inline_error_callback(void *arg);
static Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
Oid result_collation);
static Query *substitute_actual_srf_parameters(Query *expr,
int nargs, List *args);
static Node *substitute_actual_srf_parameters_mutator(Node *node,
substitute_actual_srf_parameters_context *context);
substitute_actual_srf_parameters_context *context);
static bool tlist_matches_coltypelist(List *tlist, List *coltypelist);
@@ -1011,7 +1011,7 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context)
return false;
/* Check for volatile functions in node itself */
if (check_functions_in_node(node,
contain_volatile_functions_not_nextval_checker,
contain_volatile_functions_not_nextval_checker,
context))
return true;
@@ -1026,11 +1026,11 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context)
{
/* Recurse into subselects */
return query_tree_walker((Query *) node,
contain_volatile_functions_not_nextval_walker,
contain_volatile_functions_not_nextval_walker,
context, 0);
}
return expression_tree_walker(node,
contain_volatile_functions_not_nextval_walker,
contain_volatile_functions_not_nextval_walker,
context);
}
@@ -1432,7 +1432,7 @@ contain_context_dependent_node_walker(Node *node, int *flags)
*/
*flags |= CCDN_IN_CASEEXPR;
res = expression_tree_walker(node,
contain_context_dependent_node_walker,
contain_context_dependent_node_walker,
(void *) flags);
*flags = save_flags;
return res;
@@ -2675,7 +2675,7 @@ eval_const_expressions_mutator(Node *node,
* self.
*/
args = (List *) expression_tree_mutator((Node *) expr->args,
eval_const_expressions_mutator,
eval_const_expressions_mutator,
(void *) context);
/*
@@ -2943,7 +2943,7 @@ eval_const_expressions_mutator(Node *node,
-1,
InvalidOid,
sizeof(Oid),
ObjectIdGetDatum(intypioparam),
ObjectIdGetDatum(intypioparam),
false,
true),
makeConst(INT4OID,
@@ -3009,7 +3009,7 @@ eval_const_expressions_mutator(Node *node,
*/
if (arg && IsA(arg, Const) &&
(!OidIsValid(newexpr->elemfuncid) ||
func_volatile(newexpr->elemfuncid) == PROVOLATILE_IMMUTABLE))
func_volatile(newexpr->elemfuncid) == PROVOLATILE_IMMUTABLE))
return (Node *) evaluate_expr((Expr *) newexpr,
newexpr->resulttype,
newexpr->resulttypmod,
@@ -3286,7 +3286,7 @@ eval_const_expressions_mutator(Node *node,
if (newargs == NIL)
return (Node *) makeNullConst(coalesceexpr->coalescetype,
-1,
coalesceexpr->coalescecollid);
coalesceexpr->coalescecollid);
newcoalesce = makeNode(CoalesceExpr);
newcoalesce->coalescetype = coalesceexpr->coalescetype;
@@ -3365,7 +3365,7 @@ eval_const_expressions_mutator(Node *node,
fselect->fieldnum <= list_length(rowexpr->args))
{
Node *fld = (Node *) list_nth(rowexpr->args,
fselect->fieldnum - 1);
fselect->fieldnum - 1);
if (rowtype_field_matches(rowexpr->row_typeid,
fselect->fieldnum,
@@ -3900,7 +3900,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
{
args = expand_function_arguments(args, result_type, func_tuple);
args = (List *) expression_tree_mutator((Node *) args,
eval_const_expressions_mutator,
eval_const_expressions_mutator,
(void *) context);
/* Argument processing done, give it back to the caller */
*args_p = args;
@@ -4623,7 +4623,7 @@ substitute_actual_parameters(Node *expr, int nargs, List *args,
static Node *
substitute_actual_parameters_mutator(Node *node,
substitute_actual_parameters_context *context)
substitute_actual_parameters_context *context)
{
if (node == NULL)
return NULL;
@@ -4943,7 +4943,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
querytree_list = pg_analyze_and_rewrite_params(linitial(raw_parsetree_list),
src,
(ParserSetupHook) sql_fn_parser_setup,
(ParserSetupHook) sql_fn_parser_setup,
pinfo, NULL);
if (list_length(querytree_list) != 1)
goto fail;
@@ -5066,7 +5066,7 @@ substitute_actual_srf_parameters(Query *expr, int nargs, List *args)
static Node *
substitute_actual_srf_parameters_mutator(Node *node,
substitute_actual_srf_parameters_context *context)
substitute_actual_srf_parameters_context *context)
{
Node *result;
@@ -5076,7 +5076,7 @@ substitute_actual_srf_parameters_mutator(Node *node,
{
context->sublevels_up++;
result = (Node *) query_tree_mutator((Query *) node,
substitute_actual_srf_parameters_mutator,
substitute_actual_srf_parameters_mutator,
(void *) context,
0);
context->sublevels_up--;