summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-23Mark this git repo as obsolete.HEADmasterTom Lane
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.
2020-12-28Fix typos and formatting in commentsMagnus Hagander
Author: Justin Pryzby
2020-06-30Avoid duplicate declarations of bsdindent's global variables.Tom Lane
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.xlfqhstajf6ynxyv@alap3.anarazel.de
2020-05-16Bump version to 2.1.1.REL_2_1_1Tom Lane
2020-05-16Fix formatting of macros that take types.Tom Lane
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.GA19630@alvherre.pgsql
2020-05-16Silence -Wimplicit-fallthrough warnings in pg_bsd_indent.Tom Lane
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.GB79590@paquier.xyz
2019-05-19Rip out -kr/-nkr switches again.Tom Lane
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.
2019-05-19Bump version to 2.1.Tom Lane
2019-05-18Improve indent's ability to distinguish function defs from decls.Tom Lane
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.
2019-05-18Add a lookahead mechanism for reading beyond the current input line.Tom Lane
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.)
2019-05-18Use "make test" not "make check" to run test cases.Tom Lane
The "check" rules brought in by pgxs.mk conflict with this, and produce annoying warnings, so just change the target name.
2017-06-21Revert "Tweak comment indentation to preserve 8-column-at-a-time rule."Tom Lane
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.
2017-06-20Tweak comment indentation to preserve 8-column-at-a-time rule.Tom Lane
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.
2017-06-20Adjust in_decl logic to avoid messing up enum declarations.Tom Lane
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.
2017-06-20Add feature patch for -tpg/-ntpg.Tom Lane
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.)
2017-06-20Adjust "make check" to actually pass.Tom Lane
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.
2017-06-20Add build infrastructure to build in Postgres environment.Tom Lane
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.
2017-06-20Adjust #include's to build in Postgres rather than FreeBSD environment.Tom Lane
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.
2017-06-20Import current development version of FreeBSD indent.Tom Lane
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.