Re: [HACKERS] pg_bsd_indent: implement -lps ("leave preprocessorspace")
От | Andres Freund |
---|---|
Тема | Re: [HACKERS] pg_bsd_indent: implement -lps ("leave preprocessorspace") |
Дата | |
Msg-id | 20170208190103.obudn4xxuo2guqw3@alap3.anarazel.de обсуждение исходный текст |
Ответ на | Re: [HACKERS] pg_bsd_indent: implement -lps ("leave preprocessor space") (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [HACKERS] pg_bsd_indent: implement -lps ("leave preprocessor space")
|
Список | pgsql-hackers |
On 2017-02-07 23:30:44 -0500, Tom Lane wrote: > Piotr Stefaniak <postgres@piotr-stefaniak.me> writes: > > this is a patch that Andres asked me for. It makes pg_bsd_indent leave > > preprocessor space alone, as in this example: > > > #if 0 > > # if 0 > > # if 0 > > # error > > # endif > > # endif > > #else > > # line 7 > > #endif For context: I'd asked Piotr how dificult it'd be to add this. > Um ... but the point of pgindent is to standardize spacing, not to let > people invent their own style. If you wanted to have a discussion about > whether pgindent should force preprocessor directives to look like the > above, we could talk about that. But I do not want to be reading code that > looks like the above in one place and code that does not ten lines away. I don't think that's something easily done in an automatic manner. Because you'd e.g. obviously not want to indent everything within include guards. I don't really buy the danger of large divergances in code nearby - this seems mostly useful when writing a bit more complicated macros, and I don't think they'll be that frequently added in existing files. I do think this makes the nesting for #ifdefs a *lot* more readable, and we have plenty of cases where it's currently really hard to discern what "branch" one is currently reading. Allowing to opt-in into the "newer" formatting in places where it makes sense, seems reasonable to me. Regards, Andres
В списке pgsql-hackers по дате отправления: