Commit Graph

20138 Commits

Author SHA1 Message Date
kre d736f87f8e If it isn't possible to determine the realpath() of ".", then simply
give up on attempting to resolve any relative path - there's no hope.
2023-05-25 17:24:17 +00:00
jschauma cdcf39f501 revert my previous commit as there is no agreement on it being either desired
or appropriate
2023-05-25 12:57:37 +00:00
uwe 1abf64cb1c chflags(1): fix wrong markup in previous 2023-05-25 01:31:27 +00:00
jschauma 1ddd11122e Briefly describe the 'arch' and 'nodump' flags. 2023-05-24 22:33:17 +00:00
christos c700643e72 use strchr 2023-05-24 22:14:31 +00:00
lukem ab6e6d445d m4 -g: { and } aren't supported in patsubst() or regexp()
When running in -g (GNU m4) emulation, patsubst() and regexp()
use the GNU m4 emacs-like regexes as implemented by gnulib,
which don't support {..} intervals.
When converting a GNU m4 regex to a POSIX ERE, escape raw { and }.

Autoconf relies on the GNU m4 regex behaviour.

See:
- https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Redefined-M4-Macros.html
- https://www.gnu.org/software/gnulib/manual/html_node/emacs-regular-expression-syntax.html

This fixes the tools/compat/configure regen.

PR toolchain/57431
2023-05-24 21:58:19 +00:00
lukem 8e5c6bed5f obsolete mkstr(1) and xstr(1)
These were only used on PDP-11 for two programs we don't ship,
and have been obsolete since the VAX days.

xstr never worked in the build.sh cross-build environment (22 years), or
parallel make environment (nearly 28 years), didn't work in the orignal 386bsd
import, and has never been needed in NetBSD as we don't have the older BSD
programs (pascal, pre-nvi ex) that needed mkstr/xstr on PDP-11.

PR toolchain/35964
2023-05-24 13:00:14 +00:00
rillig cc79972fb6 indent: separate code for handling enums from the lexer
The lexer's responsibility is to generate tokens, it's not supposed to
update the parser state.  Centralize the state transitions that control
indentation of enum constants to keep the lexer code clean.

Skip comments, newlines and preprocessing lines when updating the parser
state for enum constants and for '*' in declarations.
2023-05-23 18:16:28 +00:00
rillig e9b5780b33 indent: fix indentation of struct declarations 2023-05-23 16:53:57 +00:00
rillig fe5b389b2f indent: split debug output into paragraphs
The paragraphs separate the different processing steps: getting a token
from the lexer, processing the token, updating the parser state, sending
a finished line to the output.
2023-05-23 12:12:29 +00:00
rillig 18ce8f52a9 indent: extract processing of a single token to separate function
No functional change.
2023-05-23 11:37:23 +00:00
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