Previously, we would assume that a macro like IsA() in the following
example was a cast just because it mentions a known type between parens,
and that messed up the formatting of any binary operator that followed:
if (IsA(outer_path, UniquePath) ||path->skip_mark_restore)
This change errs on the side of assuming that function-like macros are
similar to sizeof() and offsetof(), so that operators are formatted
correctly:
if (IsA(outer_path, UniquePath) || path->skip_mark_restore)
Thomas Munro
Discussion: https://postgr.es/m/
20200114221814[email protected]
ps.in_or_st = false; /* turn off flag for structure decl or
* initialization */
}
- /* parenthesized type following sizeof or offsetof is not a cast */
- if (ps.keyword == 1 || ps.keyword == 2)
+ /*
+ * parenthesized type following sizeof or offsetof is not a cast,
+ * and we assume the same for any other non-keyword identifier,
+ * to support macros that take types
+ */
+ if (ps.last_token == ident &&
+ (ps.keyword == 0 || ps.keyword == 1 || ps.keyword == 2))
ps.not_cast_mask |= 1 << ps.p_l_follow;
break;