compiling pg_bsd_indent
While $SUBJECT today -- using the sources from
https://git.postgresql.org/git/pg_bsd_indent.git -- I ran into some
problems. I got errors due to the replacement of
pg_attribute_noreturn() with pg_return(), and warnings due to variable
definitions with no previous extern declaration. Here's a quick and
dirty patch.
--
Robert Haas
EDB: http://www.enterprisedb.com
Attachments:
bsdindent.patchapplication/octet-stream; name=bsdindent.patchDownload
diff --git a/err.h b/err.h
index a3e8f97..edb517e 100644
--- a/err.h
+++ b/err.h
@@ -37,9 +37,9 @@
* This is cut down to just the minimum that we need to build indent.
*/
-void err(int, const char *, ...)
- pg_attribute_noreturn() pg_attribute_printf(2, 3);
-void errx(int, const char *, ...)
- pg_attribute_noreturn() pg_attribute_printf(2, 3);
+pg_noreturn void err(int, const char *, ...)
+ pg_attribute_printf(2, 3);
+pg_noreturn void errx(int, const char *, ...)
+ pg_attribute_printf(2, 3);
#endif /* !_ERR_H_ */
diff --git a/io.c b/io.c
index 3ce8bfb..4450d11 100644
--- a/io.c
+++ b/io.c
@@ -49,7 +49,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
#include "indent_globs.h"
#include "indent.h"
-int comment_open;
+static int comment_open;
static int paren_target;
static char *lookahead_buf; /* malloc'd buffer, or NULL initially */
diff --git a/lexi.c b/lexi.c
index f01596a..8f69338 100644
--- a/lexi.c
+++ b/lexi.c
@@ -70,7 +70,7 @@ struct templ {
* This table has to be sorted alphabetically, because it'll be used in binary
* search. For the same reason, string must be the first thing in struct templ.
*/
-struct templ specials[] =
+static struct templ specials[] =
{
{"_Bool", 4},
{"_Complex", 4},
@@ -116,11 +116,11 @@ struct templ specials[] =
{"while", 5}
};
-const char **typenames;
-int typename_count;
-int typename_top = -1;
+static const char **typenames;
+static int typename_count;
+static int typename_top = -1;
-char chartype[128] =
+static char chartype[128] =
{ /* this is used to facilitate the decision of
* what type (alphanumeric, operator) each
* character is */
Hi,
On 2025-10-09 11:43:57 -0400, Robert Haas wrote:
While $SUBJECT today -- using the sources from
https://git.postgresql.org/git/pg_bsd_indent.git -- I ran into some
problems. I got errors due to the replacement of
pg_attribute_noreturn() with pg_return(), and warnings due to variable
definitions with no previous extern declaration. Here's a quick and
dirty patch.
I thought we basically only used the in-tree pg_bsd_indent these days?
Greetings,
Andres
On Thu, Oct 9, 2025 at 11:49 AM Andres Freund <andres@anarazel.de> wrote:
I thought we basically only used the in-tree pg_bsd_indent these days?
Oh, I missed the fact that we'd moved it into the tree. But it looks
like you can't build it with meson?
--
Robert Haas
EDB: http://www.enterprisedb.com
Robert Haas <robertmhaas@gmail.com> writes:
While $SUBJECT today -- using the sources from
https://git.postgresql.org/git/pg_bsd_indent.git -- I ran into some
problems. I got errors due to the replacement of
pg_attribute_noreturn() with pg_return(), and warnings due to variable
definitions with no previous extern declaration. Here's a quick and
dirty patch.
I don't think we're bothering to maintain that repo anymore,
now that pg_bsd_indent is in-tree (see src/tools/pg_bsd_indent).
The fixes you mention seem to be applied already to that copy.
regards, tom lane
On Thu, Oct 09, 2025 at 11:49:31AM -0400, Andres Freund wrote:
On 2025-10-09 11:43:57 -0400, Robert Haas wrote:
While $SUBJECT today -- using the sources from
https://git.postgresql.org/git/pg_bsd_indent.git -- I ran into some
problems. I got errors due to the replacement of
pg_attribute_noreturn() with pg_return(), and warnings due to variable
definitions with no previous extern declaration. Here's a quick and
dirty patch.I thought we basically only used the in-tree pg_bsd_indent these days?
That's what I thought, too (see commit 4e831f4). FWIW the problem in err.h
was fixed in-tree in the same way as your patch by commit 3691edf. The
missing-externs ones were fixed by adding -Wmissing-variable-declarations,
per commit 6618891.
--
nathan
On 2025-10-09 11:51:15 -0400, Robert Haas wrote:
On Thu, Oct 9, 2025 at 11:49 AM Andres Freund <andres@anarazel.de> wrote:
I thought we basically only used the in-tree pg_bsd_indent these days?
Oh, I missed the fact that we'd moved it into the tree. But it looks
like you can't build it with meson?
It can be built with meson - in fact it should be built by default...
On Thu, Oct 9, 2025 at 11:51 AM Robert Haas <robertmhaas@gmail.com> wrote:
On Thu, Oct 9, 2025 at 11:49 AM Andres Freund <andres@anarazel.de> wrote:
I thought we basically only used the in-tree pg_bsd_indent these days?
Oh, I missed the fact that we'd moved it into the tree. But it looks
like you can't build it with meson?
No, I'm wrong about that, too. I don't seem to see it installing by
default, but maybe I am also wrong about that.
--
Robert Haas
EDB: http://www.enterprisedb.com
On Thu, Oct 9, 2025 at 11:49:31AM -0400, Andres Freund wrote:
Hi,
On 2025-10-09 11:43:57 -0400, Robert Haas wrote:
While $SUBJECT today -- using the sources from
https://git.postgresql.org/git/pg_bsd_indent.git -- I ran into some
problems. I got errors due to the replacement of
pg_attribute_noreturn() with pg_return(), and warnings due to variable
definitions with no previous extern declaration. Here's a quick and
dirty patch.I thought we basically only used the in-tree pg_bsd_indent these days?
The last commit in that branch says:
commit 681a370 (HEAD -> master, origin/master, origin/HEAD)
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun Apr 23 10:38:15 2023 -0400
Mark this git repo as obsolete.
Add a README note explaining that we've pulled pg_bsd_indent
into the main Postgres source tree. This copy will not be
maintained anymore.
Might be nice if we could just remove it. It was created by Tom Lane in
2017.
The in-tree ./src/tools/pg_bsd_indent/ doesn't give me any warnings on
gcc 14.2.0.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
Robert Haas <robertmhaas@gmail.com> writes:
No, I'm wrong about that, too. I don't seem to see it installing by
default, but maybe I am also wrong about that.
No, we don't install it at all. If you choose, you can manually
copy it to someplace in your $PATH.
regards, tom lane
On 2025-Oct-09, Bruce Momjian wrote:
Might be nice if we could just remove it. It was created by Tom Lane in
2017.
I think it would be a bad idea to lose the history there, so -1 on that
from me. In particular, older branches (12 and back) require a version
of pg_bsd_indent that would no longer be available. Do I use that
often? Not really, but who knows. I'd rather have it there.
Maybe we could make the obsolence more obvious, such as by making the
Makefile emit a note about it.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
On Thu, Oct 9, 2025 at 06:12:59PM +0200, Álvaro Herrera wrote:
On 2025-Oct-09, Bruce Momjian wrote:
Might be nice if we could just remove it. It was created by Tom Lane in
2017.I think it would be a bad idea to lose the history there, so -1 on that
from me. In particular, older branches (12 and back) require a version
of pg_bsd_indent that would no longer be available. Do I use that
often? Not really, but who knows. I'd rather have it there.Maybe we could make the obsolence more obvious, such as by making the
Makefile emit a note about it.
Makes sense.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.