Commit Graph

25 Commits

Author SHA1 Message Date
Piotr Pawel Stefaniak
5088a2d18c indent(1): add fallthrough markers
This silences -Wimplicit-fallthrough warnings.

Submitted by:	Michael Paquier
Obtained from:	postgresql.org
MFC after:	3 days
2020-05-21 17:34:31 +00:00
Kyle Evans
02bde5cf13 indent: fix the -fno-common build
Spread the globals far and wide, hopefully to the files that make the most
sense.

-fno-common will become the default in GCC10/LLVM11.

MFC after:	3 days
2020-04-06 23:20:20 +00:00
Piotr Pawel Stefaniak
0dee472dd2 indent(1): revert r334640 and r334632
While STACKSIZE macro is indeed problematic on some systems, the commits
were wrong to shrink il[] and cstk[], because they need to be of the same
size as p_stack[] as they're accessed with the same index ps.tos.
2018-08-11 19:20:06 +00:00
Piotr Pawel Stefaniak
89463812e3 indent(1): move case_indent from parser state to the options struct
This was missed in r334927.
2018-07-15 21:04:21 +00:00
Piotr Pawel Stefaniak
7e53aaedd3 indent(1): group global option variables into an options structure
It's clearer now when a variable represents a toggable command line option.

Many options were stored in the parser's state structure, so fix also that.
2018-06-10 16:44:18 +00:00
Piotr Pawel Stefaniak
0929b3d971 indent(1): fix buildworld after r334632
Fix
error: comparison of integers of different signs: 'int' and 'unsigned long'
by casting nitems() to int.

Reported by:	mjg
2018-06-04 21:21:55 +00:00
Piotr Pawel Stefaniak
88b24a62d1 indent(1): remove the STACKSIZE macro and all of its use
It conflicts with a system-provided macro of the same name on another OS.
2018-06-04 20:39:58 +00:00
Pedro F. Giffuni
df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Pedro F. Giffuni
488f148604 indent(1): Avoid out-of-bound accesses of array ps.p_stack.
Submitted by:	 Piotr Stefaniak
2016-12-02 16:42:45 +00:00
Pedro F. Giffuni
df54a266d3 indent(1): Remove an extra newline added in a previous commit.
It doesn't math the remaining of the case statement.
2016-12-02 16:32:14 +00:00
Pedro F. Giffuni
b30bb755da indent(1): Optimize parser stack usage.
When special else-if processing is enabled (-ei), we can assume "else if"
and "if" to be equivalent for indentation purposes.
This reduction saves a lot of stack space in case of a long "if-else-if
... else-if" sequence;  with this change,
Postgres/src/bin/psql/tab-complete.c as of 9.6beta3
requires minimum of the stack length to be 31 instead of 444.

Submitted by:	 Piotr Sephaniak
2016-12-02 16:28:18 +00:00
Pedro F. Giffuni
743210efd6 indent(1): minor off-by-one error.
This was introduced in r303571.

Obtianed from:	Piotr Stefaniak
2016-11-27 20:11:55 +00:00
Pedro F. Giffuni
16c2e36059 indent(1): add some comments to quiet down Coverity.
Hopefully adding comments should help explain the code to both static
checkers and humans.

CID:	976543, 976544, 976545
Obtained from:	Piotr Stephaniak
2016-08-23 01:58:02 +00:00
Pedro F. Giffuni
70a3049ea5 indent(1): Use a dash in the license headers.
Use of the canonical dash avoids indent(1) from reformatting the
license headers.
2016-08-01 16:40:42 +00:00
Pedro F. Giffuni
5467ab90aa indent(1): Bail out if there's no more space on the parser stack.
Also increase the stack size still keeping a conservative value of 256.
This is based on a similar changes done for PostgreSQL which instead
uses a stack size of 1000.

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak (with changes)
2016-07-31 04:58:06 +00:00
Philippe Charnier
d005495293 err() on allocation failure. WARNS=9 compliant
use #if 0, #ifndef lint, #endif /* not lint */, #endif ordering
when a message is provided, use errx() instead of err().
2003-06-15 09:28:17 +00:00
Philippe Charnier
dc51023cb3 Spelling 2002-10-16 13:58:39 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Juli Mallett
90af6a724e Remove deprecated register qualifier. 2002-06-24 17:40:27 +00:00
Jens Schweikhardt
7916863d82 Make this compile cleanly when warnings are enabled:
- ANSIfy function declarations
 - braces around initializers structs within structs
 - add parens in complicated expressions
 - disambiguate dangling elses
 - no more implicit int
 - make functions static where possible
 - use prototypes
 - don't use varargs hack for diag()

Requested by: joerg
MFC after:	2 weeks
2001-10-28 18:35:32 +00:00
David E. O'Brien
175f26d6ed Don't abuse the SCCS `@(#)' for RCS.
Requested by:	bde
2000-12-25 01:16:12 +00:00
David E. O'Brien
9e50dd7726 Add or fix FreeBSD IDs. 2000-12-09 09:52:52 +00:00
Robert Nordier
34ba737933 Improve handling of "do ... while" following "else". This change
eliminates some incorrect "Unmatched 'else'" errors.
1999-05-21 14:46:52 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00