Re: pgindent && weirdness
От
Tom Lane
Тема
Re: pgindent && weirdness
Дата
Msg-id
17361.1590100806@sss.pgh.pa.us
Ответ на
Re: pgindent && weirdness (Piotr Stefaniak)
Список
Дерево обсуждения
pgindent && weirdness Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Bruce Momjian <bruce@momjian.us>
Re: pgindent && weirdness Thomas Munro <thomas.munro@gmail.com>
Re: pgindent && weirdness Thomas Munro <thomas.munro@gmail.com>
Re: pgindent && weirdness Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pgindent && weirdness Michael Paquier <michael@paquier.xyz>
Re: pgindent && weirdness Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Thomas Munro <thomas.munro@gmail.com>
Re: pgindent && weirdness Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pgindent && weirdness Thomas Munro <thomas.munro@gmail.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Thomas Munro <thomas.munro@gmail.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Thomas Munro <thomas.munro@gmail.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Stephen Frost <sfrost@snowman.net>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Alvaro Herrera <alvherre@2ndquadrant.com>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Re: pgindent && weirdness Piotr Stefaniak <postgres@piotr-stefaniak.me>
Re: pgindent && weirdness Tom Lane <tgl@sss.pgh.pa.us>
Piotr Stefaniak writes: > On 16/01/2020 03.59, Thomas Munro wrote: >> One way to fix that in the cases Alvaro is referring to is to tell >> override the setting so that && (and likewise ||) are never considered >> to be unary, though I haven't tested this much and there are surely >> other ways to achieve this: > I think this is a better approach then the one committed to > pg_bsd_indent. It's ubiquitous that the operators are binary, except - > as you mentioned - in a nonstandard GCC syntax. The alternative given > has more disadvantages, with potential impact on FreeBSD code > formatting, which it should support as well as everything else -- to a > reasonable extent. sys/kern/ is usually a decent litmus test, but I > don't claim it should show anything interesting in this particular case. I think that the fix we chose is better, at least for our purposes. You can see its effects on our source tree at https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fa27dd40d5c5f56a1ee837a75c97549e992e32a4 and while certainly most of the diffs are around && or || operators, there are a fair number that are not, such as - dummy_lex.input = unconstify(char *, str) +1; + dummy_lex.input = unconstify(char *, str) + 1; or more interestingly - strncmp(text, "pg_", 3) !=0) + strncmp(text, "pg_", 3) != 0) where the previous misformatting is because "text" is a known typedef name. So it appears to me that this change reduces the misformatting cost of typedef names that chance to match field or variable names, and that's actually quite a big issue for us. We have, ATM, 3574 known typedefs in typedefs.list, a fair number of which are not under our control (since they come from system headers on various platforms). So it's inevitable that there are going to be collisions. In short, I'm inclined to stick with the hack we've got. I'm sad that it will result in further divergence from FreeBSD indent; but it does useful stuff for us, and I don't want to give it up. (That said, I don't see any penalty to carrying both changes; so we'll probably also absorb the &&/|| change at some convenient time.) regards, tom lane
В списке pgsql-hackers по дате отправления