Re: pgindent && weirdness

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: pgindent && weirdness
Дата
Msg-id CA+hUKGJqy2Vy5pLzHg70=LivBUbFVALmcZ0OLBkJa9-iSq7wLQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgindent && weirdness  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: pgindent && weirdness
Список pgsql-hackers
On Thu, Jan 16, 2020 at 3:59 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Wed, Jan 15, 2020 at 11:30 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Yeah, it's been doing that for decades.  I think the triggering
> > factor is the typedef name (Var, here) preceding the &&.

Here's a better fix:

diff --git a/indent.c b/indent.c
index 9faf57a..51a60a6 100644
--- a/indent.c
+++ b/indent.c
@@ -570,8 +570,11 @@ check_type:
                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;
+                * likewise for function-like macros that take a type
+                */
+           if (ps.keyword == 1 || ps.keyword == 2 || ps.last_token == ident)
                ps.not_cast_mask |= 1 << ps.p_l_follow;
            break;



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: psql - add SHOW_ALL_RESULTS option
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: psql - add SHOW_ALL_RESULTS option