Commit Graph

193 Commits

Author SHA1 Message Date
Enji Cooper
4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Piotr Pawel Stefaniak
fbdbd284ae indent(1): add option -tsn for setting tab size. 2017-07-25 17:04:35 +00:00
Piotr Pawel Stefaniak
3e2c1447d5 indent(1): better alignment of comments on code.
If aligning the beginning of a comment to -cn would mean no space between
code and the comment, align it to the next tab stop.
2017-07-23 20:25:53 +00:00
Piotr Pawel Stefaniak
d0d51a3322 indent(1): rename the profile file.
Currently, indent's testing mechanism will attempt to apply options from
a file named ${test}.pro - and this test's filename is comments.0.
2017-07-23 15:07:52 +00:00
Piotr Pawel Stefaniak
f30beab3a1 indent(1): don't produce unnecessary blank lines.
Don't force a blank line between an opening brace and a block comment -- not
even if -bbb (blank lines before block comments) is on.
2017-07-23 14:33:04 +00:00
Piotr Pawel Stefaniak
a3abcad0b7 indent(1): don't produce unneeded space character in function declarators. 2017-07-23 14:04:45 +00:00
Piotr Pawel Stefaniak
bd2969a00d indent(1): Support binary integer literals.
This was done by Romain Tartière for PR123553. I initially thought that it would break code like this:
#define b00101010 -1
if (0 b00101010)
...

by joining 0 and b00101010 together. However, the real problem with that patch was that once it saw a 0, it assumed that the number was base 2, 8 or 16, ignoring base 10 floating point numbers. I fixed that.

I didn't copy the diagnostic part of the original patch as it seems out of scope of implementing binary integer literals formatting.

PR:		123553
Submitted by:	romain (original version)
Approved by:	pfg (mentor)
2017-05-18 17:15:58 +00:00
Enji Cooper
7d9ade5da1 Integrate indent tests added in r313544 into ATF/Kyua and the FreeBSD
test suite

This change does the following:

- Introduces symmetry in the test inputs/outputs by adding the exit
  code to the files. This simplified the test driver notably by
  requiring less filename/test name manipulation.
- Adds a test driver for the testcases added in r313544, patterned
  after bin/sh/tests/functional_test.sh . The driver calls indent as
  noted in r313544, with an exception: The $FreeBSD$ RCS keyword's
  expansion is reindented with indent, which means that the output
  differs from the expected output. Thus, all lines with $FreeBSD$
  in them are deleted on the fly, both in the input file and the
  output file.

  The test inputs/outputs are copied to the kyua sandbox before the
  test is run as the pathing in some of the files relies on pathing
  normalized to the current directory (copying the files is the
  easiest way to resolve the issue).

Approved by:	pstef (maintainer)
Reviewed by:	pstef
X-MFC with:	r313544
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D9682
2017-03-03 20:15:22 +00:00
Piotr Pawel Stefaniak
61fd3be0b0 indent(1): add regression test cases
These examples show expected behavior of indent(1). They are meant to be used
together with a regression test mechanism, either Kyua, a Makefile or perhaps
something else. The mechanism should in essence do this:
  indent -P${test}.pro < ${test}.0 > ${test}.0.run
and compare ${test}.0.stdout to ${test}.0.run. If the files differ or the exit
status isn't 0, the test failed.

* ${test}.pro is an indent(1) profile: a list of options passed through a file.
  The program doesn't complain if the file doesn't exist.
* ${test}.0 is a C source file which acts as input for indent(1). It doesn't
  have to have any particular formatting, since it's the output that matters.
* ${test}.0.stdout contains expected output. It doesn't have to be formatted in
  Kernel Normal Form as the point of the tests is to check for regressions in
  the program and not to check that it always produces KNF.

Reviewed by:	ngie
Approved by:	pfg (mentor)
Differential Revision:	https://reviews.freebsd.org/D9007
2017-02-10 09:31:39 +00:00
Piotr Pawel Stefaniak
183668da96 indent(1): add a piece missed in r311138. 2017-01-02 20:49:24 +00:00
Piotr Pawel Stefaniak
86adac04b2 indent(1): add option -P for loading user-provided files as profiles
Without this change, indent(1) would only look to load options from ~/.indent.pro if it's there and -npro wasn't used on the command line. This option lets the user set their own path to the file.

Approved by:	pfg (mentor)
Differential Revision:	https://reviews.freebsd.org/D9010
2017-01-02 20:23:46 +00:00
Piotr Pawel Stefaniak
93567e8778 indent(1): Avoid out of bounds access of array ps.paren_indents
ps.p_l_follow can't be allowed to grow beyond maximum index of paren_indents.

Approved by:	pfg (mentor)
2016-12-30 21:00:45 +00:00
Pedro F. Giffuni
bde60d7544 indent(1): remove unneeded comma.
It is not a good practice to start a newline with a comma anyways.

Discussed with:	 bjk
Differential Revision:	https://reviews.freebsd.org/D8690
2016-12-04 03:10:25 +00:00
Pedro F. Giffuni
86bd08e9ee Document undocumented indent(1) options badp/nbadp, bs/nbs, and lc.
Submitted by:	 Piotr Stefaniak
Differential Revision:	https://reviews.freebsd.org/D8690
2016-12-03 00:24:34 +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
0bae80a336 indent(1): Avoid out-of-bound accesses of arrays.
ps.paren_indents:
When ps.paren_level was 0, this was accessing paren_indents[-1].

in_buffer:
This fragment checks if "*/" was read, but there's no guarantee that there
is more than one byte in the array (actually, this happens frequently for
the "{" in things like "int main(void) {").

Submitted by:	 Piotr Stefaniak
2016-12-02 16:41:08 +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
cba6bdf9bc indent(1): Do not define opchar unless it will be used.
"opchar" is only used once depending on "undef" macro being defined.
Conditionalize it in the same way.

Submitted by:	Piotr Sephaniak
2016-12-02 01:52:32 +00:00
Pedro F. Giffuni
f171328eaa indent(1): Fix indent's confusion about custom FreeBSD macros.
Teach indent(1) about storage-class specifiers. Don't assume
"in_parameter_declaration" state if "in_decl" hasn't been set. Don't set
"in_decl" for storage-class specifiers.

That set of changes helps with recognizing the difference between file
scope declarations like this:

static LIST_HEAD(, alq) ald_active;
static int ald_shuttingdown = 0;
struct thread *ald_thread;

and old style function declarators like this:

static int
do_execve(td, args, mac_p)
	struct thread *td;
	struct image_args *args;
	struct mac *mac_p;
{

Unfortunately, at the same time this change makes indent(1) require
explicit int in declarations like "static a;", in order to understand that
it's part of a declaration. On the other hand, declarations like in the
first example are no longer indented as if ald_shuttingdown and ald_thread
were parameters of a function named LIST_HEAD.

Submitted by:	 Piotr Stefaniak
2016-12-02 01:25:51 +00:00
Pedro F. Giffuni
909f007fb8 indent(1): Don't unnecessarily add a blank before a comment ends.
pr_comment() did avoid adding surplus space character when a comment
contained it at the end. Now it's also paying attention to tabs.

Taken from:	 Piotr Stefaniak
2016-12-01 01:56:34 +00:00
Pedro F. Giffuni
67b7daecf7 indent(1): Don't ignore newlines after comments that follow braces.
indent.c has a special loop that stores tokens from between an if () and
the next statement into a buffer. The loop ignored all newlines, but that
resulted in not calling dump_line() when it was needed to produce the
final line of the buffered up comment.

Taken from:	 Piotr Stefaniak
2016-12-01 01:48:56 +00:00
Pedro F. Giffuni
458051a57b indent(1): Avoid out of bound access of array in_buffer
Work-around a somewhat complex interaction within the code. From
Piotr's commit [1]:

When pr_comment() calls dump_line() for the first line of a multiline
comment, it doesn't include any indentation - it starts with the "/*".
This is consistent for both boxed and not boxed comments. Where the logic
diverges is in how it treats the rest of the lines of the comment. For box
comments indent assumes that it must not change anything, so lines are
dumped as they were, including the indentation where it exists. For the
rest of comments, it will first remove the indentation to store plain text
of the comment and then add it again where indent thinks it's appropriate
-- this is part of comment re-indenting process.

For continuations of multi-line comments, the code that handles comments
in dump_line() will use pad_output() to create indentation from the
beginning of the line (what indent calls the first column) and then write
string pointed by s_com afterwards. But if it's a box comment, the string
will include original indentation, unless it's the first line of the
comment. This is why tab characters from s_com have to be considered when
calculating how much padding is needed and the "while (*com_st == '\t')
com_st++, target += 8;" does that.

In dump_line(), /target/ is initially set to ps.com_col, so it always
assumes that indentation needs to be produced in this function, regardless
of which line of a box comment it is. But for the first line of a box
comment it is not true, so pr_comment() signals it by setting
ps.n_comment_delta, the negative comment delta, to a negative number which
is then added to /target/ in dump_line() on all lines except the first
one, so that the function produces adequate indentation in this special
case.

The bug was in how that negative offset was calculated: pr_comment() used
count_spaces() on in_buffer, which pr_comment() expected to contain
non-null terminated sequence of characters, originating from whatever
originally was on the left side of the comment. Understanding that
count_spaces() requires a string, pr_comment() temporarily set buf_ptr[-2]
to 0 in hope that it would nul-terminate the right thing in in_buffer and
calling count_spaces() would be safe and do the expected thing. This was
false whenever buf_ptr would point into save_com, an entirely different
char array than in_buffer.

The short-term fix is to recognize whether buf_ptr points into in_buffer
or save_com.

Reference:
[1]
ea486a2aa3

Taken from:	 Piotr Stefaniak
2016-12-01 01:32:13 +00:00
Pedro F. Giffuni
350fcdd5df indent(1): Properly handle the wide string literal and wide char constant L.
indent(1) treated the "L" in "L'a'" as if it were an identifier and forced
a space character after it, breaking valid code.

PR:		143090
MFC after:	2 weeks
2016-11-27 20:38:14 +00:00
Pedro F. Giffuni
6daffe6ebf indent(1): fix regression introduced in r303596.
Multi-line comments are always block comments in KNF. Restore properly,
handling the case when a long one-liner gets wrapped and becomes a
multi-line comment.

Obtained from:	Piotr Stefaniak
2016-11-27 20:30:09 +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
Conrad Meyer
d36899d10f Move sys/capsicum.h includes after types.h or param.h
This is not actually documented or even implied in style(9).  Make the change
to match convention.  Someone should document this convention in style(9).

Reported by:	jhb
Sponsored by:	EMC Dell Isilon
2016-09-19 20:43:03 +00:00
Conrad Meyer
10cc720c25 indent(1): Capsicumify
This is a nice and trivial program for sandboxing.  One input file, one
output file.

Reviewed by:	pfg
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7920
2016-09-19 16:16:14 +00:00
Pedro F. Giffuni
bf140447ba indent(1): have the memset invocation somewhat more canonical.
While correct, the previous invocation was somewhat more error prone.

Pointed out by:	delphij, bde
2016-08-23 15:49:31 +00:00
Pedro F. Giffuni
38359266c5 indent(1): remove dead assignments.
Taken from:	Piotr Sephaniak
2016-08-23 15:46:20 +00:00
Pedro F. Giffuni
8e7c1235ce indent(1): Fix off-by-one in control flow leading dead code.
Coverity correctly reported that it's impossible for /comparison/ to be 0
here, because the only way for the for loop to end is by /comparison/
being < 0.

Fortunately the consequences of this bug weren't severe; for duplicated
entries in the typedef names file it would unnecessarily duplicate strings
with strdup(), but pointers to those would replace existing ones. So this
was a memory leak at worst.

CID:	 1361477
Obtained from:	 Piotr Stephaniak
2016-08-23 02:07:08 +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
f3c23ec321 indent(1): Fix memory leaks pointed out by clang-analyzer.
Shift the responsibility of allocating memory for the string duplicate
from the caller (set_option, add_typedefs_from_file) to the callee
(add_typename) as it has more knowledge about when the duplication
actually needs to occur.

Taken from:	Piotr Stefaniak
2016-08-23 01:40:45 +00:00
Pedro F. Giffuni
a6bcfda487 indent(1): Use bsearch() for looking up type keywords.
Reference:
f3b8e6e57f

Submitted by:	Piotr Stefaniak
Differential Revision: https://reviews.freebsd.org/D6966
2016-08-04 15:27:09 +00:00
Pedro F. Giffuni
771aff0aa5 indent(1): add new -sac and -U options.
Add -sac (space after cast) and -nsac options.
These control whether space character is put after a cast operator or not.
Default is -nsac.

Add -U option for providing a file containing list of types.
This is needed for properly deciding which asterisks denote unary
operation and which denote binary.

These come from PostgreSQL.

Reference:
84b00e3d46
49c52cf383

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-08-03 22:08:07 +00:00
Pedro F. Giffuni
b4939677e8 indent(1): accept offsetof(3) as a keyword.
Reference:
c470e5e2c9

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-08-03 16:33:34 +00:00
Pedro F. Giffuni
707e8dae2d indent: Avoid using values of pointers that refer to deallocated space.
For now maintain the local style in this file.

Reviewed by:	jilles

Reference:
9099a9f17b

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-08-01 19:24:01 +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
e725fe4b06 indent(1): Rearrange option parsing code to squelch clang's static analyzer.
clang-analyzer complained that eqin() sets file-scoped pointer param_start
to point into char buffer defined in scan_profile(), and once
scan_profile() exits, param_start is a "dangling reference". param_start
was never used afterwards, but it's cleaner to move it to set_option()
which is the only branch where param_start is needed.

Reference:
ab0e44e5da

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:43:43 +00:00
Pedro F. Giffuni
efc12d78f7 indent(1): replace function call to bzero with memset.
Reference:
7422f42f80

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:36:40 +00:00
Pedro F. Giffuni
f7adee2314 indent(1): Don't newline on cpp lines like #endif unless -bacc is on.
Reference:
01f36f4141

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:29:10 +00:00
Pedro F. Giffuni
69e66b43bc indent(1): Untangle the connection between pr_comment.c and io.c.
It's pr_comment.c that should decide whether to put a "star comment
continuation" or not. This duplicates code a bit, but it simplifies
pr_comment() at the same time since pr_comment() no longer has to "signal"
whether a star continuation is needed or not.

This change requires indent(1) to not wrap comment lines that lack a blank
character, but I think it's for the better if you look at cases when that
happens (mostly long URIs and file system paths, which arguably shouldn't
be wrapped).

It also fixes two bugs:

1. Cases where asterisk is a part of the comment's content (like in "*we*
are the champions") and happens to appear at the beginning of the line,
misleading dump_line() into thinking that this is part of the star comment
continuation, leading to misalignment.

2. Cases where blank starred lines had three too many characters on the
line when wrapped.

Reference:
3b41ee78aa

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:09:22 +00:00
Pedro F. Giffuni
8ad92a65e4 indent(1): Fix wrapping of some lines in comments.
After a blank line was printed (to separate paragraphs in comments), the
next line was sometimes wrapped to the column at which the previous
non-empty line ended. The fix is to reset the last blank pointer (last_bl)
on newline.

References:
345663c07a

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 20:13:00 +00:00
Pedro F. Giffuni
54d57555a3 indent(1): Simplify pr_comment().
Modify count_spaces() to take a third parameter "end" that will make the
function return when the end is reached. This lets the caller pass a
pointer to non nul-terminated sequence of characters. Rename
count_spaces() to count_spaces_until() and reinstate count_spaces(), this
time based on count_spaces_until().

Use count_spaces_until() to recalculate current column when going through
a comment just before the fragment which decides if current line of the
comment should be wrapped. This move simplifies this code by eliminating
the need for keeping the column counter up to date every time e_com is
advanced and also reduces spread of code that has to know how many columns
a tab will produce.

Deduplicate code that decided if a comment needs a blank line at the top.

References:
d9fa3b4815
27185b4b33

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 20:04:18 +00:00
Pedro F. Giffuni
267c747003 indent(1): Remove dead code relating to unix-style comments.
The original indent(1) described unix-style comments as similar to box
comments, except the first non-blank character on each line is lined up
with the '*' of the "/*" which appears on a line by itself.

The code has been turned off for ages and -sc/-nsc make it even
less relevant.

Reference:
89c5fe2c56

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)

Submitted by:	Piotr Stefaniak
2016-07-31 15:02:53 +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
Pedro F. Giffuni
11c4989364 indent(1): Consistently indent declarations.
This fixes a very visible issue that may be hidden by some indent.pro
settings as in the example from FreeBSD's /usr/share.

From Piotr's log:
____
To prevent losing tabs from indentation in declarations, FreeBSD indent's
r125624 added code for the most common case when it's an identifier that
is indented, but didn't do anything with the original code that did the
same for any other cases. The other cases are: lparens (function pointer
declaration), asterisks (pointer declaration), stray semicolons, and
commas leading identifiers instead of trailing them.

Use the code added in r125624 (and improved in later commits) to write a
new function indent_declaration() and use it in all places that meant to
indent declarations. In order to indent only once per line, reuse existing
ps.dumped_decl_indent variable that was only used when formatting for
troff (-troff) until now.
____

Reference:
ddd263db2a

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 04:14:20 +00:00
Marcelo Araujo
6cf1bae2d9 Use nitems() from sys/param.h.
MFC after:	2 weeks.
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 07:28:15 +00:00
Pedro F. Giffuni
e643b783e3 indent(1): Yet more style issues.
strchr(3) returns a pointer not a boolean.
Attempt to make the style somewhat more ocnsistent with what indent
had before recent changes.

Pointed out by:	bde
2016-07-30 01:04:18 +00:00
Pedro F. Giffuni
9b4009b417 indent(1): Attempt to preserve some consistent style.
Remove the excessive braces from r303485 and align the comments to the
right as done in the rest of the code. This is not nice but there is no
clear way to make it nice (and KNF).

Pointed out by:	bde
2016-07-29 23:30:33 +00:00
Pedro F. Giffuni
c917a54b26 indent(1): Use NULL instead of zero for pointers. 2016-07-29 19:36:10 +00:00
Pedro F. Giffuni
9f827409fb indent(1): Support "f" and "F" floating constant suffixes.
Actually this just brings back r303487 with the correct commit log.

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 18:00:10 +00:00
Pedro F. Giffuni
b58cc20a1a Revert r303487: Wrong commit log.
Will be brought back with the correct log.
2016-07-29 17:55:38 +00:00
Pedro F. Giffuni
09544f7d97 indent(1): Removed whitespace shouldn't be considered in column calculations.
This piece of code removed tabs and space characters from after colons
that follow labels by decrementing the e_lab (end of label) "pointer"
which is later used to calculate the width of the string that fprintf()
puts into "output". But pad_output() gets the length from the actual
string, so it miscalculated what the current column is.

Fixed by putting a string terminator at the e_lab "pointer".

Differential Revision: https://reviews.freebsd.org/D6966
(Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:34:16 +00:00
Pedro F. Giffuni
e5302a297b indent(1): fix struct termination detection.
Small style cleanup while here.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:28:51 +00:00
Pedro F. Giffuni
bb88f82294 indent(1): fix struct termination detection.
Semicolons inside struct declarations don't end the declarations.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:23:00 +00:00
Pedro F. Giffuni
5cd358485e indent(1): Fix breakage caused by single comment following "else".
indent(1) simply wasn't taught that "else" may be followed by a comment
without any opening brace anywhere on the line, so it was very confused
in such cases.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:17:54 +00:00
Pedro F. Giffuni
11821cabe8 indent(1): Avoid potential use-after-free.
last_bl is a char pointer that tracks the last blank character in a
comment, which is used for wrapping long comment lines. Since the
underlying array may be reallocated, make sure last_bl is up to date when
that happens.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:14:03 +00:00
Pedro F. Giffuni
19fe172ace indent(1): Avoid out of bound access of array codebuf.
dump_line() requires s_code to be a string, because it will call count_spaces().

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:09:05 +00:00
Pedro F. Giffuni
0504bd6580 indent: avoid calling write(2) with a negative second parameter.
negative_returns: n is passed to a parameter that cannot be negative.
Fix a style issue while here.

CID:	1008107
2016-07-28 16:54:12 +00:00
Pedro F. Giffuni
b67565942b indent(1): Fix typo.
It's typedef, not typdef.

Obtained from:	OpenBSD (CVS rev. 1.20)
MFC after:	3 days
2016-06-06 16:10:52 +00:00
Eitan Adler
463a577b27 Fix a ton of speelling errors
arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
2015-10-21 05:37:09 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Eitan Adler
dda5b39711 multiple: Remove 3rd clause from BSD license where approved by the
regents and renumber.

This patch skips files in contrib/ and crypto/

Acked by:	imp
Discussed with:	emaste
2014-03-14 03:07:51 +00:00
Joel Dahl
7e700c30d2 mdoc: minor paragraph fixes. 2014-02-08 13:37:02 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Ed Schouten
7e659f9491 Add the Clang specific -Wmissing-variable-declarations to WARNS=6.
This compiler flag enforces that that people either mark variables
static or use an external declarations for the variable, similar to how
-Wmissing-prototypes works for functions.

Due to the fact that Yacc/Lex generate code that cannot trivially be
changed to not warn because of this (lots of yy* variables), add a
NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this
specific compiler warning.

Announced on:	toolchain@
2013-04-19 19:45:00 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Andrew Turner
34fa2a3532 Make struct fstate aligned to the same as an int as its pointer is cast to
an int pointer in args.c. This fixes an issue with ARM where the struct
will be byte aligned but an int pointer must be 4 byte aligned.
2012-12-22 04:11:59 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl
126b754db4 Remove superfluous paragraph macro. 2012-03-25 09:19:25 +00:00
Eitan Adler
d1b25cd91b Document the [n]eei and [n]bacc options
PR:		docs/165009
Submitted by:	Jeremy Huddleston <jeremyhu@apple.com>
Approved by:	bcr
MFC after:	1 week
2012-03-03 18:07:53 +00:00
Ulrich Spörlein
487ac9ac21 Spelling fixes for usr.bin/ 2011-12-30 11:02:40 +00:00
Dimitry Andric
f7c0d4c7ea In usr.bin/indent/io.c, fix a few warnings about format strings not being literals.
MFC after:	1 week
2011-12-17 15:41:58 +00:00
Kevin Lo
f5f8c098c7 Use NULL instead of 0 when setting up pointer. 2010-08-10 06:58:12 +00:00
Andriy Gapon
c27b391b3f indent(1): don't treat bare '_t' as a type name when -ta is used
It seems that identifier "_t" is sometimes used as a variable name,
even in our tree.  Not that I endorse that, but still it's better
to require at least one character before _t suffix to consider
an identifier to be a type name.

Reported by:	Alex Vasylenko <lxv@omut.org>
MFC after:	1 week
2010-04-15 21:41:07 +00:00
Andriy Gapon
c58c7416c7 indent(1): add a new option, -ta, to treat all *_t identifiers as types
Submitted by:	Hans Petter Selasky
Discussed with:	bde
MFC after:	10 days
2010-03-31 17:05:30 +00:00
Andriy Gapon
6953f51a9d indent(1): correctly handle case/label at the very start of a function
Obtained from:	NetBSD (rev. 1.11 of indent.c)
MFC after:	1 week
2010-03-31 16:55:47 +00:00
Philippe Charnier
488633c7f4 initialize variable (WARNS=6) 2006-09-13 05:06:12 +00:00
Diomidis Spinellis
855196e9fa Use the appropriate error function for displaying the error,
instead of printing it to stdout.

MFC after:	1 week
2005-11-20 13:48:15 +00:00
David Malone
84032c0a6d Declare find_err in indent_globs.h where the other shared variables
live rather than listing it as an extern in indent.c.
2005-11-13 20:37:25 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Ruslan Ermilov
36a142c455 Expand contractions. 2005-02-13 23:45:54 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ceri Davies
fa5c581ccf Quote example file names consistently, and fix a small grammatical nit. 2005-02-04 11:37:49 +00:00
Giorgos Keramidas
d8aa7ce5ca Clarify a bit the BUGS section.
PR:		docs/77024
Submitted by:	Adrian Filipi <adrian@ubergeeks.com>
Reviewed by:	ru
2005-02-03 21:16:23 +00:00
David Schultz
c4c326cf1d Fix a buffer overflow by using strncpy() instead of strcpy().
Also, use strdup() instead of malloc()/strcpy().

PR:		64164
2004-09-19 20:34:30 +00:00
Ruslan Ermilov
557b7fa148 Deal with double whitespace. 2004-07-03 00:24:45 +00:00
Ruslan Ermilov
6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
Jens Schweikhardt
a6a6666238 Bump document date.
Submitted by:	ru
2004-06-30 19:56:16 +00:00
Jens Schweikhardt
5ac16458a1 Document recently acquired options.
PR:		67983
Submitted by:	Chip Norkus <wd@teleri.net>
MFC after:	2 weeks
2004-06-29 18:57:13 +00:00
Jens Schweikhardt
e3625e9c22 Fix problems with non-8 space tabs. New options for function
declarations with the opening brace on the same line as the declaration
of arguments all spaces and no tabs (a feature which exists in GNU's
indent). Man page update to follow RSN.

PR:		bin/67983
Submitted by:	Chip Norkus <wd@teleri.net>
Style guidance and bug for bug compatibility by:	bde
MFC after:	2 weeks
2004-06-27 10:58:37 +00:00
Ruslan Ermilov
fc7589061d Fixed document date. 2004-05-19 09:49:54 +00:00
Dag-Erling Smørgrav
efc4d24dd6 Support C-style comments in profile. 2004-03-21 04:47:54 +00:00