Commit Graph

20127 Commits

Author SHA1 Message Date
rillig fadc996fc6 indent: fix spacing around '*' in declarations 2023-05-23 06:43:19 +00:00
rillig 756425c686 indent: fix spacing in declarations in for loops 2023-05-23 06:35:01 +00:00
rillig 8bd40c7adb indent: fix spacing between block braces 2023-05-22 23:03:16 +00:00
rillig ce93a72ddb indent: adjust indentation in lexer
No binary change.
2023-05-22 22:09:45 +00:00
rillig 7536a08b97 lint.1: add a few examples
In default mode, lint runs in a mode that aids in migrating from
traditional C to C90, which is not widely useful nowadays.  Instead,
suggest some examples of using lint in more practical ways.
2023-05-22 19:36:13 +00:00
rillig d48d494d44 lint: use consistent variable name for redeclared symbol
No binary change.
2023-05-22 18:10:57 +00:00
rillig 960cfb1b4e lint: fix emitted type for arrays of unknown size 2023-05-22 17:53:27 +00:00
rillig 58c9f35c13 lint: clean up the name of a local variable
No binary change.
2023-05-22 17:47:27 +00:00
rillig f14ab694cd lint: rename constant NOTSPEC to NO_TSPEC
It was too easy to misread the old name as NOT_SPEC instead of the
intended NO_TSPEC.
2023-05-22 12:55:04 +00:00
rillig b95ee04d96 indent: implement suppressing optional blank lines 2023-05-22 10:28:59 +00:00
rillig c99fb69e72 tests/indent: fix outdated or wrong comments 2023-05-21 10:18:44 +00:00
rillig 243cf9019e indent: don't read out-of-bounds memory in preprocessing lines
(Since a few minutes.)

If a line '#if 0' was followed by an unlikely line '#', the second line
was interpreted as '#if' as well.

To detect this bug automatically, a dynamic analysis tool would need to
know that only the memory between lab.mem and lab.mem + lab.len has
defined content.  This constraint, in turn, would throw up at the bottom
of copy_comment_wrap, which for a brief moment intentionally violates
this constraint.
2023-05-21 10:05:20 +00:00
rillig 4779b6fb88 indent: don't error out on unrecognized preprocessor directives
This allows indent to be used on the GCC preprocessor output.
2023-05-21 09:48:22 +00:00
rillig 687b1dc030 indent: remove redundant checks in processing of '}'
No functional change.
2023-05-20 16:31:31 +00:00
rillig fe2fb3c8db indent: don't insert blank line between two closing lines 2023-05-20 12:05:01 +00:00
rillig 4fb425a29f indent: extract the output state from the parser state
The parser state depends on the preprocessing lines, the output state
shouldn't.
2023-05-20 11:53:53 +00:00
rillig 5a9a628018 indent: implement blank line above block comment 2023-05-20 11:19:17 +00:00
rillig 1764a17f2c indent: implement blank line after function body 2023-05-20 10:46:21 +00:00
rillig c7613eff0b indent: ensure that no blank lines are inserted in INDENT OFF mode
No blank lines were inserted previously, but the code looked
suspicious as if that were possible.
2023-05-20 10:25:47 +00:00
rillig 4d19140d48 indent: implement blank lines around conditional compilation 2023-05-20 10:09:02 +00:00
rillig e174834cff indent: add debug logging for brace indentation
No functional change outside debug mode, as the initialization of
di_stack[0] was redundant.
2023-05-20 02:47:35 +00:00
rillig 86c76bf510 indent: clean up lexing of word tokens
No functional change.
2023-05-20 01:28:14 +00:00
rillig 182fed1007 indent: separate detection of function definitions from lexing '*'
No functional change.
2023-05-20 00:17:56 +00:00
uwe 13772c7301 chflags(1): minor markup fixes 2023-05-19 19:50:59 +00:00
jschauma 0102e2de2a We mention secmodel_securelevel(9) in the details, so might as well add it to
SEE ALSO.
2023-05-19 16:14:00 +00:00
jschauma 7abe1e38c4 Note that the ability to change certain flags depends on the current securelevel. 2023-05-18 19:08:16 +00:00
rillig d46fdfe393 indent: document the funcname token 2023-05-18 08:09:28 +00:00
rillig 4cc242ff56 indent: remove detailed rules for blank before comment 2023-05-18 07:13:05 +00:00
rillig 7a108102a1 indent: rename a few functions
No functional change.
2023-05-18 06:01:39 +00:00
rillig 2d18db1bfc indent: manually wrap overly long lines
No functional change.
2023-05-18 05:33:27 +00:00
rillig 3bf5120b21 indent: switch to standard code style
Taken from share/misc/indent.pro.

Indent does not wrap code to fit into the line width, it only does so
for comments.  The 'INDENT OFF' sections and too long lines will be
addressed in a follow-up commit.

No functional change.
2023-05-18 04:23:03 +00:00
rillig 31b88f5f5a indent: remove unnecessary variable size optimization
Due to the enum that follows in the struct, the short variable was
padded to 4 bytes anyway.

No functional change.
2023-05-18 03:38:34 +00:00
rillig 00fa12d4c2 indent: fix indentation in preprocessor line
No binary change.
2023-05-17 18:03:25 +00:00
lukem b8a22b4ebe ftp 20230516 for openssl 3.0 compat SSL_OP_IGNORE_UNEXPECTED_EOF 2023-05-16 22:00:23 +00:00
christos 3778483fd3 Ignore EOF from remote. 2023-05-16 18:52:09 +00:00
rillig 6c7dba2d21 indent: directly access the input buffer
No functional change.
2023-05-16 13:26:26 +00:00
rillig 032a64ad39 indent: allow comments in column 1 to be formatted 2023-05-16 12:46:43 +00:00
rillig 81c7fd789d indent: remove support for form feed characters inside a line
Form feeds are occasionally used to split code into pages, and this use
is still supported.  Having a form feed in the middle of a line is
exotic.
2023-05-16 11:32:01 +00:00
rillig db245c79a9 indent: remove blank between comment and parentheses or brackets
Finally, indent formats its own source code without messing up the
layout.
2023-05-16 08:22:11 +00:00
rillig c5b428c7c1 indent: fix handling of INDENT OFF/ON comments
Previously, the 'INDENT OFF' comments were interpreted when the newline
token from the line above the comment was processed, which was earlier
than could be reasonably expected.

The 'INDENT ON' comments were interpreted equally early, which led to
the situation that the 'INDENT OFF' comments were preserved literally
but the 'INDENT ON' comments weren't.
2023-05-16 08:04:03 +00:00
rillig c73b132b15 indent: move parsing of 'INDENT OFF/ON' comments to the lexer
No functional change.
2023-05-16 07:13:05 +00:00
rillig a0b2b7f9f6 indent: clean up detection of whether parentheses form a cast
No functional change.
2023-05-15 22:52:21 +00:00
rillig 62cf6a24f7 indent: fix cast detection
In process_lparen_or_lbracket, ps.paren[...].maybe_cast was not
initialized, which may have been the cause for seemingly random spacing
around binary operators.

While here, clean up the code by reducing the number of accesses to the
parser state.
2023-05-15 22:35:41 +00:00
rillig 70c3f641d2 indent: fix detection of casts
A word followed by a '(' does not start a cast expression.
2023-05-15 21:51:45 +00:00
rillig 62d29170f1 indent: fix type cast in function definition 2023-05-15 20:50:37 +00:00
rillig 4ebb9a565a indent: clean up local indentation profile
The -eei option now works, the type hints are no longer necessary.
2023-05-15 20:35:56 +00:00
rillig a59ea3192b indent: fix duplicate space between comment and binary operator 2023-05-15 20:30:20 +00:00
rillig 9b57bdf0e0 indent: format its own code, extend some comments
With manual corrections, as there are still some bugs left.

No functional change.
2023-05-15 20:12:28 +00:00
rillig 2aaa93dadf indent: fix line wrapping of comments to the right of code 2023-05-15 19:55:51 +00:00
rillig 219ccf6233 indent: improve type guessing, fix formatting of declarations 2023-05-15 18:22:40 +00:00