summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Tom Lane [Sun, 23 Apr 2023 14:38:15 +0000 (10:38 -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.
Magnus Hagander [Mon, 28 Dec 2020 10:36:28 +0000 (11:36 +0100)]
Fix typos and formatting in comments
Author: Justin Pryzby
Tom Lane [Tue, 30 Jun 2020 01:19:16 +0000 (21:19 -0400)]
Avoid duplicate declarations of bsdindent's global variables.
Arrange for all the variable declarations in indent_globs.h to look
like "extern" declarations to every .c file except indent.c.
This prevents linker failure due to duplicated global variables when
the code is built with -fno-common, which is soon to be gcc's default.
The method of temporarily #define'ing "extern" to empty is a hack,
no doubt, but it avoids requiring a duplicate set of variable
definitions, so it seemed like the best way.
Discussion: https://postgr.es/m/
20200629165051[email protected]
Tom Lane [Sat, 16 May 2020 15:39:11 +0000 (11:39 -0400)]
Bump version to 2.1.1.
Tom Lane [Sat, 16 May 2020 15:36:23 +0000 (11:36 -0400)]
Fix formatting of macros that take types.
Previously, we would assume that a macro like IsA() in the following
example was a cast just because it mentions a known type between parens,
and that messed up the formatting of any binary operator that followed:
if (IsA(outer_path, UniquePath) ||path->skip_mark_restore)
This change errs on the side of assuming that function-like macros are
similar to sizeof() and offsetof(), so that operators are formatted
correctly:
if (IsA(outer_path, UniquePath) || path->skip_mark_restore)
Thomas Munro
Discussion: https://postgr.es/m/
20200114221814[email protected]
Tom Lane [Sat, 16 May 2020 15:07:48 +0000 (11:07 -0400)]
Silence -Wimplicit-fallthrough warnings in pg_bsd_indent.
Since the recommended build method uses Postgres' preferred CFLAGS,
and those now include -Wimplicit-fallthrough, we now see these
warnings where we did not before.
Michael Paquier
Discussion: https://postgr.es/m/
20200515060318[email protected]
Tom Lane [Sun, 19 May 2019 19:45:13 +0000 (15:45 -0400)]
Rip out -kr/-nkr switches again.
The upstream maintainer doesn't want these, so drop 'em.
Also, teach is_func_definition() about //-style comments. The main
lexi.c code doesn't know about those either, but I assume somebody
will wish to fix that at some point.
Tom Lane [Sun, 19 May 2019 00:00:33 +0000 (20:00 -0400)]
Bump version to 2.1.
Tom Lane [Sat, 18 May 2019 23:59:04 +0000 (19:59 -0400)]
Improve indent's ability to distinguish function defs from decls.
The previous coding for deciding whether "foo(" begins a function
definition or just a declaration was quite stupid: it could be
fooled by nested parentheses in the parameter list, or comments
in or after the parameter list, or whitespace just after the
parameter list. And it didn't work if the parameter list crossed
a line boundary, either.
We can upgrade all those cases without any objectionable side
effects, I believe. However, there's one more case that's
problematic: if there's non-punctuation stuff after the
parenthesized arguments, it's difficult to tell whether that
stuff is K&R-style parameter declarations or function attributes.
I don't care to try to make the lookahead code smart enough to
tell the difference, so instead let's invent a switch to tell
what to do. The '-kr' mode is backward-compatible, hence the
default. The '-nkr' mode will do the right thing with function
attributes and the wrong thing with pre-ANSI function declarations;
but for a code base with none of the latter, that hardly matters.
Tom Lane [Sat, 18 May 2019 22:21:12 +0000 (18:21 -0400)]
Add a lookahead mechanism for reading beyond the current input line.
It's truly remarkable that indent has survived this long without
growing such a capability. (The bp_save stuff seems to be a sort
of half-baked version of it, with restricted functionality and
limited buffer size.)
Tom Lane [Sat, 18 May 2019 21:34:13 +0000 (17:34 -0400)]
Use "make test" not "make check" to run test cases.
The "check" rules brought in by pgxs.mk conflict with this, and
produce annoying warnings, so just change the target name.
Tom Lane [Wed, 21 Jun 2017 18:39:55 +0000 (14:39 -0400)]
Revert "Tweak comment indentation to preserve 8-column-at-a-time rule."
This reverts commit
1c64f6883442e8e5f9ede00002dbeb7af073e90f.
The only reason for pushing that commit at all is to document the
hacked version of pg_bsd_indent that I used for Postgres commit
e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89. We aren't going to keep
that hack going forward.
Tom Lane [Tue, 20 Jun 2017 20:50:22 +0000 (16:50 -0400)]
Tweak comment indentation to preserve 8-column-at-a-time rule.
BSD indent places comments that follow code on a line in column 33
(or whatever -c selects), or as many tab stops to the right of that
as are needed to clear the code. In PG's old pgindent implementation,
indent believed it was working with 8-column tabs so that's where such
comments got placed. In the new implementation, indent knows it's
working with 4-column tab stops, so that affects the placement of
such comments. That's an improvement, since it often allows more
comment text on a line. However, I'd like to absorb that change
separately from all the other ones, just to keep the diffs a bit more
reviewable. Hence, temporarily hack the comment indent logic so
that it does 8-column indents regardless of the -ts setting.
This hack also preserves (more or less) some odd behavior right at
the boundary.
Tom Lane [Tue, 20 Jun 2017 19:45:41 +0000 (15:45 -0400)]
Adjust in_decl logic to avoid messing up enum declarations.
This is a workaround for an acknowledged upstream bug; it basically
reverts this logic to the way it was in NetBSD indent. While there
may eventually be a different upstream fix, this will do for our
purposes. Add a regression test case that illustrates the problem,
and tweak declarations.0.stdout for slightly different formatting
produced for a function pointer typedef.
Tom Lane [Tue, 20 Jun 2017 19:27:29 +0000 (15:27 -0400)]
Add feature patch for -tpg/-ntpg.
This switch enables using Postgres' rules for using tabs vs spaces
in indents, to match the output of our old "entab" program.
The FreeBSD maintainer wants no part of this, so we'll have to carry
this as a forked patch. (The alternative is to go over to use-tabs-
whenever-possible rules, but that would result in circa 10K lines of
invisible whitespace diffs in the PG sources, which seems like lots
more pain than is justified.)
Tom Lane [Tue, 20 Jun 2017 19:17:08 +0000 (15:17 -0400)]
Adjust "make check" to actually pass.
The f_decls test doesn't quite pass currently, because there's too
much whitespace in the function return types. We don't particularly
care about this for PG purposes, as NetBSD indent did that too, and
we've always had a fixup step for it in the pgindent wrapper script.
So make the expected output file match what actually happens.
(If this ever does get fixed by upstream, we can take that fixup
step out of pgindent.)
In passing, make the "make check" script less noisy.
Tom Lane [Tue, 20 Jun 2017 19:09:25 +0000 (15:09 -0400)]
Add build infrastructure to build in Postgres environment.
Add a Makefile that works with the PGXS infrastructure.
Add err.h and err.c, taken from FreeBSD 11 and cut down to just
the minimum support needed by indent.
Add README.pg_bsd_indent with simple build instructions,
and .gitignore.
Tom Lane [Tue, 20 Jun 2017 18:56:53 +0000 (14:56 -0400)]
Adjust #include's to build in Postgres rather than FreeBSD environment.
Remove '#include <sys/cdefs.h>', which will fail in many non-BSD
environments, as well as the __FBSDID() FreeBSD-ism. Replace them
with '#include "c.h"', which will allow use of the Postgres
project's portability infrastructure. This is intended to be a
permanent diff between the FreeBSD upstream files and our copy.
Tom Lane [Tue, 20 Jun 2017 18:45:29 +0000 (14:45 -0400)]
Import current development version of FreeBSD indent.
This commit copies Piotr Stefaniak's development repo
https://github.com/pstef/freebsd_indent
as of commit
5d3b621cd54de672983c51d9622dee84d458dd83 (2017-06-18).
But I've omitted Makefile and Makefile.depend, as they are of no use
in non-BSD build environments.