diff options
| author | Tom Lane | 2017-06-21 19:18:54 +0000 |
|---|---|---|
| committer | Tom Lane | 2017-06-21 19:19:25 +0000 |
| commit | c7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch) | |
| tree | e85979fb1213a731b7b557f8a830df541f26b135 /src/backend/parser | |
| parent | f669c09989bda894d6ba01634ccb229f0687c08a (diff) | |
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
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
Diffstat (limited to 'src/backend/parser')
| -rw-r--r-- | src/backend/parser/analyze.c | 12 | ||||
| -rw-r--r-- | src/backend/parser/parse_agg.c | 2 | ||||
| -rw-r--r-- | src/backend/parser/parse_clause.c | 4 | ||||
| -rw-r--r-- | src/backend/parser/parse_coerce.c | 10 | ||||
| -rw-r--r-- | src/backend/parser/parse_collate.c | 6 | ||||
| -rw-r--r-- | src/backend/parser/parse_cte.c | 4 | ||||
| -rw-r--r-- | src/backend/parser/parse_expr.c | 32 | ||||
| -rw-r--r-- | src/backend/parser/parse_func.c | 18 | ||||
| -rw-r--r-- | src/backend/parser/parse_node.c | 4 | ||||
| -rw-r--r-- | src/backend/parser/parse_oper.c | 2 | ||||
| -rw-r--r-- | src/backend/parser/parse_relation.c | 12 | ||||
| -rw-r--r-- | src/backend/parser/parse_utilcmd.c | 8 |
12 files changed, 57 insertions, 57 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 86482eba26e..3e2f64866d5 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -268,7 +268,7 @@ transformStmt(ParseState *pstate, Node *parseTree) default: break; } -#endif /* RAW_EXPRESSION_COVERAGE_TEST */ +#endif /* RAW_EXPRESSION_COVERAGE_TEST */ switch (nodeTag(parseTree)) { @@ -2103,7 +2103,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, grpcl->tleSortGroupRef = 0; grpcl->eqop = eqop; grpcl->sortop = sortop; - grpcl->nulls_first = false; /* OK with or without sortop */ + grpcl->nulls_first = false; /* OK with or without sortop */ grpcl->hashable = hashable; op->groupClauses = lappend(op->groupClauses, grpcl); @@ -2124,7 +2124,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, rescolnode->collation = rescolcoll; rescolnode->location = bestlocation; restle = makeTargetEntry((Expr *) rescolnode, - 0, /* no need to set resno */ + 0, /* no need to set resno */ NULL, false); *targetlist = lappend(*targetlist, restle); @@ -2605,7 +2605,7 @@ LCS_asString(LockClauseStrength strength) void CheckSelectLocking(Query *qry, LockClauseStrength strength) { - Assert(strength != LCS_NONE); /* else caller error */ + Assert(strength != LCS_NONE); /* else caller error */ if (qry->setOperations) ereport(ERROR, @@ -2844,7 +2844,7 @@ applyLockingClause(Query *qry, Index rtindex, { RowMarkClause *rc; - Assert(strength != LCS_NONE); /* else caller error */ + Assert(strength != LCS_NONE); /* else caller error */ /* If it's an explicit clause, make sure hasForUpdate gets set */ if (!pushedDown) @@ -2907,4 +2907,4 @@ test_raw_expression_coverage(Node *node, void *context) context); } -#endif /* RAW_EXPRESSION_COVERAGE_TEST */ +#endif /* RAW_EXPRESSION_COVERAGE_TEST */ diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index 6218ee94fa4..9f721f80a85 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -1310,7 +1310,7 @@ check_ungrouped_columns_walker(Node *node, gvar->varno == var->varno && gvar->varattno == var->varattno && gvar->varlevelsup == 0) - return false; /* acceptable, we're okay */ + return false; /* acceptable, we're okay */ } } diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 3d5b20836f6..ad76108ba6d 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -1323,7 +1323,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, ListCell *lx, *rx; - Assert(j->usingClause == NIL); /* shouldn't have USING() too */ + Assert(j->usingClause == NIL); /* shouldn't have USING() too */ foreach(lx, l_colnames) { @@ -3389,7 +3389,7 @@ addTargetToGroupList(ParseState *pstate, TargetEntry *tle, grpcl->tleSortGroupRef = assignSortGroupRef(tle, targetlist); grpcl->eqop = eqop; grpcl->sortop = sortop; - grpcl->nulls_first = false; /* OK with or without sortop */ + grpcl->nulls_first = false; /* OK with or without sortop */ grpcl->hashable = hashable; grouplist = lappend(grouplist, grpcl); diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 2c3f3cd9ce7..aa6a16185f2 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -549,7 +549,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids, /* accept if target is polymorphic, for now */ if (IsPolymorphicType(targetTypeId)) { - have_generics = true; /* do more checking later */ + have_generics = true; /* do more checking later */ continue; } @@ -1443,7 +1443,7 @@ check_generic_type_consistency(Oid *actual_arg_types, { if (actual_type == UNKNOWNOID) continue; - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(array_typeid) && actual_type != array_typeid) return false; array_typeid = actual_type; @@ -1452,7 +1452,7 @@ check_generic_type_consistency(Oid *actual_arg_types, { if (actual_type == UNKNOWNOID) continue; - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(range_typeid) && actual_type != range_typeid) return false; range_typeid = actual_type; @@ -1662,7 +1662,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types, } if (allow_poly && decl_type == actual_type) continue; /* no new information here */ - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(array_typeid) && actual_type != array_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), @@ -1682,7 +1682,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types, } if (allow_poly && decl_type == actual_type) continue; /* no new information here */ - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(range_typeid) && actual_type != range_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), diff --git a/src/backend/parser/parse_collate.c b/src/backend/parser/parse_collate.c index aa443f23ad5..d99e4cc0f47 100644 --- a/src/backend/parser/parse_collate.c +++ b/src/backend/parser/parse_collate.c @@ -332,7 +332,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) /* Node's result type isn't collatable. */ collation = InvalidOid; strength = COLLATE_NONE; - location = -1; /* won't be used */ + location = -1; /* won't be used */ } } break; @@ -428,7 +428,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) /* Node's result type isn't collatable. */ collation = InvalidOid; strength = COLLATE_NONE; - location = -1; /* won't be used */ + location = -1; /* won't be used */ } /* @@ -711,7 +711,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) /* Node's result type isn't collatable. */ collation = InvalidOid; strength = COLLATE_NONE; - location = -1; /* won't be used */ + location = -1; /* won't be used */ } /* diff --git a/src/backend/parser/parse_cte.c b/src/backend/parser/parse_cte.c index dfbcaa2cdcc..dbe4cc23934 100644 --- a/src/backend/parser/parse_cte.c +++ b/src/backend/parser/parse_cte.c @@ -331,7 +331,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) lctypmod = lnext(lctypmod); lccoll = lnext(lccoll); } - if (lctyp != NULL || lctypmod != NULL || lccoll != NULL) /* shouldn't happen */ + if (lctyp != NULL || lctypmod != NULL || lccoll != NULL) /* shouldn't happen */ elog(ERROR, "wrong number of output columns in WITH"); } } @@ -637,7 +637,7 @@ checkWellFormedRecursion(CteState *cstate) CommonTableExpr *cte = cstate->items[i].cte; SelectStmt *stmt = (SelectStmt *) cte->ctequery; - Assert(!IsA(stmt, Query)); /* not analyzed yet */ + Assert(!IsA(stmt, Query)); /* not analyzed yet */ /* Ignore items that weren't found to be recursive */ if (!cte->cterecursive) diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index e46aa60097f..3a9cdb42089 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -48,20 +48,20 @@ bool Transform_null_equals = false; * Node-type groups for operator precedence warnings * We use zero for everything not otherwise classified */ -#define PREC_GROUP_POSTFIX_IS 1 /* postfix IS tests (NullTest, etc) */ -#define PREC_GROUP_INFIX_IS 2 /* infix IS (IS DISTINCT FROM, etc) */ -#define PREC_GROUP_LESS 3 /* < > */ -#define PREC_GROUP_EQUAL 4 /* = */ -#define PREC_GROUP_LESS_EQUAL 5 /* <= >= <> */ -#define PREC_GROUP_LIKE 6 /* LIKE ILIKE SIMILAR */ -#define PREC_GROUP_BETWEEN 7 /* BETWEEN */ -#define PREC_GROUP_IN 8 /* IN */ -#define PREC_GROUP_NOT_LIKE 9 /* NOT LIKE/ILIKE/SIMILAR */ -#define PREC_GROUP_NOT_BETWEEN 10 /* NOT BETWEEN */ -#define PREC_GROUP_NOT_IN 11 /* NOT IN */ -#define PREC_GROUP_POSTFIX_OP 12 /* generic postfix operators */ -#define PREC_GROUP_INFIX_OP 13 /* generic infix operators */ -#define PREC_GROUP_PREFIX_OP 14 /* generic prefix operators */ +#define PREC_GROUP_POSTFIX_IS 1 /* postfix IS tests (NullTest, etc) */ +#define PREC_GROUP_INFIX_IS 2 /* infix IS (IS DISTINCT FROM, etc) */ +#define PREC_GROUP_LESS 3 /* < > */ +#define PREC_GROUP_EQUAL 4 /* = */ +#define PREC_GROUP_LESS_EQUAL 5 /* <= >= <> */ +#define PREC_GROUP_LIKE 6 /* LIKE ILIKE SIMILAR */ +#define PREC_GROUP_BETWEEN 7 /* BETWEEN */ +#define PREC_GROUP_IN 8 /* IN */ +#define PREC_GROUP_NOT_LIKE 9 /* NOT LIKE/ILIKE/SIMILAR */ +#define PREC_GROUP_NOT_BETWEEN 10 /* NOT BETWEEN */ +#define PREC_GROUP_NOT_IN 11 /* NOT IN */ +#define PREC_GROUP_POSTFIX_OP 12 /* generic postfix operators */ +#define PREC_GROUP_INFIX_OP 13 /* generic infix operators */ +#define PREC_GROUP_PREFIX_OP 14 /* generic prefix operators */ /* * Map precedence groupings to old precedence ordering @@ -741,7 +741,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) break; } default: - crerr = CRERR_TOO_MANY; /* too many dotted names */ + crerr = CRERR_TOO_MANY; /* too many dotted names */ break; } @@ -2574,7 +2574,7 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr) * If so, replace the raw name reference with a parameter reference. (This * is a hack for the convenience of plpgsql.) */ - if (cexpr->cursor_name != NULL) /* in case already transformed */ + if (cexpr->cursor_name != NULL) /* in case already transformed */ { ColumnRef *cref = makeNode(ColumnRef); Node *node = NULL; diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index eb1706a4a69..38a73ba122c 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -317,7 +317,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, int catDirectArgs; tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcid)); - if (!HeapTupleIsValid(tup)) /* should not happen */ + if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for aggregate %u", funcid); classForm = (Form_pg_aggregate) GETSTRUCT(tup); aggkind = classForm->aggkind; @@ -658,7 +658,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, aggref->aggfnoid = funcid; aggref->aggtype = rettype; /* aggcollid and inputcollid will be set by parse_collate.c */ - aggref->aggtranstype = InvalidOid; /* will be set by planner */ + aggref->aggtranstype = InvalidOid; /* will be set by planner */ /* aggargtypes will be set by transformAggregateCall */ /* aggdirectargs and args will be set by transformAggregateCall */ /* aggorder and aggdistinct will be set by transformAggregateCall */ @@ -667,7 +667,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, aggref->aggvariadic = func_variadic; aggref->aggkind = aggkind; /* agglevelsup will be set by transformAggregateCall */ - aggref->aggsplit = AGGSPLIT_SIMPLE; /* planner might change this */ + aggref->aggsplit = AGGSPLIT_SIMPLE; /* planner might change this */ aggref->location = location; /* @@ -713,7 +713,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, WindowFunc *wfunc = makeNode(WindowFunc); Assert(over); /* lack of this was checked above */ - Assert(!agg_within_group); /* also checked above */ + Assert(!agg_within_group); /* also checked above */ wfunc->winfnoid = funcid; wfunc->wintype = rettype; @@ -811,7 +811,7 @@ int func_match_argtypes(int nargs, Oid *input_typeids, FuncCandidateList raw_candidates, - FuncCandidateList *candidates) /* return value */ + FuncCandidateList *candidates) /* return value */ { FuncCandidateList current_candidate; FuncCandidateList next_candidate; @@ -1077,7 +1077,7 @@ func_select_candidate(int nargs, if (input_base_typeids[i] != UNKNOWNOID) continue; - resolved_unknowns = true; /* assume we can do it */ + resolved_unknowns = true; /* assume we can do it */ slot_category[i] = TYPCATEGORY_INVALID; slot_has_preferred_type[i] = false; have_conflict = false; @@ -1205,7 +1205,7 @@ func_select_candidate(int nargs, { if (input_base_typeids[i] == UNKNOWNOID) continue; - if (known_type == UNKNOWNOID) /* first known arg? */ + if (known_type == UNKNOWNOID) /* first known arg? */ known_type = input_base_typeids[i]; else if (known_type != input_base_typeids[i]) { @@ -1292,8 +1292,8 @@ func_get_detail(List *funcname, bool *retset, /* return value */ int *nvargs, /* return value */ Oid *vatype, /* return value */ - Oid **true_typeids, /* return value */ - List **argdefaults) /* optional return value */ + Oid **true_typeids, /* return value */ + List **argdefaults) /* optional return value */ { FuncCandidateList raw_candidates; FuncCandidateList best_candidate; diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index fb3d117a7d4..f3edc6396a6 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -367,7 +367,7 @@ transformArraySubscripts(ParseState *pstate, sizeof(int32), Int32GetDatum(1), false, - true); /* pass by value */ + true); /* pass by value */ } else { @@ -511,7 +511,7 @@ make_const(ParseState *pstate, Value *value, int location) typeid = INT8OID; typelen = sizeof(int64); - typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */ + typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */ } } else diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 4b1db76e19f..529d2bf3af7 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -319,7 +319,7 @@ static FuncDetailCode oper_select_candidate(int nargs, Oid *input_typeids, FuncCandidateList candidates, - Oid *operOid) /* output argument */ + Oid *operOid) /* output argument */ { int ncandidates; diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index e412d0f9d30..84a1d79c6e5 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -1249,7 +1249,7 @@ addRangeTableEntry(ParseState *pstate, rte->inFromCl = inFromCl; rte->requiredPerms = ACL_SELECT; - rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ + rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ rte->selectedCols = NULL; rte->insertedCols = NULL; rte->updatedCols = NULL; @@ -1304,7 +1304,7 @@ addRangeTableEntryForRelation(ParseState *pstate, rte->inFromCl = inFromCl; rte->requiredPerms = ACL_SELECT; - rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ + rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ rte->selectedCols = NULL; rte->insertedCols = NULL; rte->updatedCols = NULL; @@ -1471,7 +1471,7 @@ addRangeTableEntryForFunction(ParseState *pstate, rtfunc->funccoltypes = NIL; rtfunc->funccoltypmods = NIL; rtfunc->funccolcollations = NIL; - rtfunc->funcparams = NULL; /* not set until planning */ + rtfunc->funcparams = NULL; /* not set until planning */ /* * Now determine if the function returns a simple or composite type. @@ -2615,7 +2615,7 @@ expandRelAttrs(ParseState *pstate, RangeTblEntry *rte, markVarForSelectPriv(pstate, varnode, rte); } - Assert(name == NULL && var == NULL); /* lists not the same length? */ + Assert(name == NULL && var == NULL); /* lists not the same length? */ return te_list; } @@ -2684,7 +2684,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum, tp = SearchSysCache2(ATTNUM, ObjectIdGetDatum(rte->relid), Int16GetDatum(attnum)); - if (!HeapTupleIsValid(tp)) /* shouldn't happen */ + if (!HeapTupleIsValid(tp)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute %d of relation %u", attnum, rte->relid); att_tup = (Form_pg_attribute) GETSTRUCT(tp); @@ -2868,7 +2868,7 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum) tp = SearchSysCache2(ATTNUM, ObjectIdGetDatum(rte->relid), Int16GetDatum(attnum)); - if (!HeapTupleIsValid(tp)) /* shouldn't happen */ + if (!HeapTupleIsValid(tp)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute %d of relation %u", attnum, rte->relid); att_tup = (Form_pg_attribute) GETSTRUCT(tp); diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 6bc9c531c73..30e7caeb625 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -91,7 +91,7 @@ typedef struct * the table */ IndexStmt *pkey; /* PRIMARY KEY index, if any */ bool ispartitioned; /* true if table is partitioned */ - PartitionBoundSpec *partbound; /* transformed FOR VALUES */ + PartitionBoundSpec *partbound; /* transformed FOR VALUES */ } CreateStmtContext; /* State shared by transformCreateSchemaStmt and its subroutines */ @@ -1213,7 +1213,7 @@ transformOfType(CreateStmtContext *cxt, TypeName *ofTypename) tuple = typenameType(NULL, ofTypename, NULL); check_of_type(tuple); ofTypeId = HeapTupleGetOid(tuple); - ofTypename->typeOid = ofTypeId; /* cached for later */ + ofTypename->typeOid = ofTypeId; /* cached for later */ tupdesc = lookup_rowtype_tupdesc(ofTypeId, -1); for (i = 0; i < tupdesc->natts; i++) @@ -2403,7 +2403,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString, assign_expr_collations(pstate, *whereClause); /* this is probably dead code without add_missing_from: */ - if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */ + if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */ ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("rule WHERE condition cannot contain references to other relations"))); @@ -2420,7 +2420,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString, nothing_qry->commandType = CMD_NOTHING; nothing_qry->rtable = pstate->p_rtable; - nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */ + nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */ *actions = list_make1(nothing_qry); } |
