Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.

From: Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.
Date: 2017-05-18 20:51:48
Message-ID: VI1PR03MB11991149E9EB761125DD0E23F2E40@VI1PR03MB1199.eurprd03.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2017-05-18 18:13, Tom Lane wrote:
> Piotr Stefaniak <postgres(at)piotr-stefaniak(dot)me> writes:
>> That, I assume, would be me. Coincidentally, I'm about to push my fixes
>> upstream (FreeBSD). Before that happens, my changes can be obtained from
>> https://github.com/pstef/freebsd_indent and tested, if anyone wishes.
>
> I spent a little bit of time on portability testing, because we are
> certainly going to insist that this tool be portable to more than
> just FreeBSD. Things are not very good as it stands:
>
> * Makefile is 100% BSD-specific. Possibly we could just agree to
> disagree on that point, and include a PG-style makefile that is not
> like upstream's. I attach the one I used for test purposes.

This would have to live outside of FreeBSD for obvious (or not) reasons.
Most likely as a part of pg_bsd_indent. I use the original ("BSD")
Makefile on Linux, feeding it to bmake(1). But I don't expect bmake to
become a requirement for pg_bsd_indent.

> * __FBSDID() macros fail to compile anywhere else than FreeBSD.
> Couldn't you hide those inside #if 0, as you're already doing for
> the ancient sccsid strings?

The use of __FBSDID macro won't be going anywhere from FreeBSD indent,
I'm afraid. But I think it could be if-def'd out under systems other
than FreeBSD.

> * Please put the copyright[] string in indent.c inside #if 0 too,
> as that draws unreferenced-variable warnings on some compilers.
>
> * There's one use of bcopy(), please replace with memmove().

These could probably be done upstream. I'd like to convert the strings
to comments.

> * References to <sys/cdefs.h> and <err.h> are problematic, as both
> are BSD-isms not found in POSIX. They seem to be available anyway
> on Linux, but I bet not on Windows or SysV-tradition boxes.
> I removed the <sys/cdefs.h> includes and didn't see any problems,
> but removing <err.h> exposes calls to err() and errx(), which
> we'd have to find replacements for. Maybe just change them to
> standard-conforming printf() + exit()?

I'll look into why indent includes sys/cdefs.h. I don't expect to be
allowed to replace err() and errx() with equivalent solutions based on
ISO C and POSIX. I fear the idea of detecting err*() support prior to
compilation... Probably a much simpler solution would be to replace
err*() with equivalent solutions in the PG's fork of indent. printf()
and exit() would probably be insufficient, you'd also need strerror(), I
think.

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-05-18 22:06:16 Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)
Previous Message Piotr Stefaniak 2017-05-18 20:27:18 Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-05-18 20:54:28 Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Previous Message Piotr Stefaniak 2017-05-18 20:27:18 Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)