rillig
600fe2a7c7
tests/lint: rework tests for type names
2023-07-01 20:57:37 +00:00
rillig
c6d4ed97fd
lint: clean up typos
2023-07-01 09:21:31 +00:00
rillig
130b20d8de
lint: fix initialization of unnamed union member
2023-07-01 06:09:24 +00:00
rillig
91f591a176
tests/lint: test initializing an unnamed union
2023-06-30 22:27:47 +00:00
rillig
c7c89cb5fa
lint: clean up names related to declaration levels
...
The previous prefix 'DK_' (declaration level kind) had a conflict with
the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'.
The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
2023-06-30 21:39:54 +00:00
rillig
e50dbdf451
lint: fix handling of unnamed struct/union members
...
The support for unnamed struct/union members that was added in decl.c
1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers
of these structures and computed wrong sizes for structures containing
anonymous unions. At that time, the handling of initializers was broken
as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c
* external/mit/xorg/lib/dri.old/Makefile
2023-06-30 21:06:18 +00:00
rillig
f6c9a3ff5c
lint: clean up handling of declarations
...
No functional change.
2023-06-30 19:10:49 +00:00
rillig
fc9c97fa4c
tests/lint: extend tests for sizeof and alignof
2023-06-30 16:39:17 +00:00
rillig
cb8166a1d1
lint: fix computation of bit-field width
...
When bit-fields in packed structs were added on 2009-10-02, lint assumed
that they would only use 'signed int' or 'unsigned int' as storage unit,
even though C99 also allows _Bool.
The cleanup commit for decl.c 1.225 from 2021-08-28 accidentally changed
the rounding mode for bit-field storage units from round-up to
round-down.
2023-06-30 15:19:09 +00:00
rillig
9ae9809bbf
lint: make alignof(incomplete enum) an error
2023-06-30 09:26:03 +00:00
rillig
bf86468d4c
tests/lint: add more tests for sizeof, offsetof, alignof
2023-06-30 09:21:52 +00:00
rillig
082684fd88
lint: add query for assigning an integer 0 to a pointer
2023-06-30 08:45:22 +00:00
rillig
7aaf3a0593
tests/lint: extend test for sizeof and offsetof
2023-06-30 08:03:01 +00:00
rillig
10704a6fff
tests/lint: demonstrate bugs in anonymous struct/union handling
2023-06-30 07:18:02 +00:00
rillig
aca02333cc
tests/lint: demonstrate wrong size calculation in anonymous union
2023-06-28 21:41:27 +00:00
rillig
87eefb9092
tests/lint: do not overwrite expected files that only differ in spaces
2023-06-28 20:51:31 +00:00
rillig
15b1ffda11
tests/lint: fix preprocessor line number validation
...
When running the tests via ATF, the filename was an absolute filename,
while the preprocessing line in the test file uses a relative filename.
These two didn't match.
2023-06-28 17:53:21 +00:00
rillig
b6d101e5c9
tests/lint: demonstrate wrong handling of nested initializer
...
Seen in external/bsd/jemalloc/dist/src/jemalloc.c, init_lock.
2023-06-28 15:04:07 +00:00
rillig
86d9dbede8
tests/lint: use standard form of ATF tests, test removing output file
2023-06-28 09:35:42 +00:00
rillig
f6c6195c8b
indent: fix 'blank line above first statement in function body'
2023-06-27 04:41:23 +00:00
rillig
36e71c5abd
tests/indent: test the -badp option
2023-06-27 04:28:16 +00:00
rillig
45e235d0ba
indent: improve heuristics for '*' as pointer in for loops
2023-06-26 20:23:40 +00:00
rillig
0982504e1c
indent: improve heuristics for '*' as a pointer type
2023-06-26 20:10:23 +00:00
rillig
f73b959d75
indent: implement 'blank line above first statement in function body'
2023-06-26 20:03:09 +00:00
rillig
b54a4db2fc
indent: in -bad mode, don't add a blank line above a comment or '}'
2023-06-26 14:54:40 +00:00
rillig
eead40953d
tests/indent: strengthen requirements for test input files
...
Previously, 'indent run-equals-prev-output' was allowed even when there
was no 'indent run' section above. This created an ambiguity, since
'previous output' could mean either the 'indent run' section or the
'indent run-equals-input' section.
2023-06-26 12:21:18 +00:00
rillig
aa3872d78f
tests/indent: extend test for -badp option
2023-06-26 11:01:08 +00:00
rillig
ac483ee881
indent: treat 'complex' and 'imaginary' as type modifiers, not as types
2023-06-25 19:29:57 +00:00
rillig
9745d1edfa
indent: fix formatting of parenthesized name in function definition
2023-06-25 19:19:42 +00:00
rillig
6ef27db9bc
lint: don't warn about comparison between char and character constant
2023-06-24 17:50:31 +00:00
rillig
271d535ea8
lint: add query for comparing 'char' with plain integers
2023-06-24 08:11:12 +00:00
rillig
a127f918f7
tests/lint: allow accept.sh to override lint1 for local testing
2023-06-24 07:45:36 +00:00
rillig
4a6e788063
lint: add query for redundant 'extern' in function declaration
2023-06-24 06:55:34 +00:00
msaitoh
d1b93bab8c
Fix typo in comment.
2023-06-24 05:27:13 +00:00
rillig
12dc98af47
indent: fix scanning of no-wrap comments (since 2021.11.07.10.34.03)
...
The "refactoring" back then tried to be too clever.
2023-06-23 20:59:04 +00:00
rillig
f7b95e49e6
tests/indent: fix comments
2023-06-23 20:44:51 +00:00
rillig
ec19c40c90
lint: add query for comma operator
2023-06-22 13:57:44 +00:00
rillig
69d93118ce
tests/lint: comma operators are not allowed in constant expressions
2023-06-19 12:33:43 +00:00
knakahara
8d5cb09c67
Repair test coverage. I revert by proxy as the committer seems too busy to even reply mail.
...
TODO:
Provide some way for small machines to run subset test so that they get
shorter run time at the expense of test coverage.
2023-06-19 08:28:09 +00:00
rillig
c4d462617d
indent: only add blank lines before actual block comments
2023-06-18 07:32:33 +00:00
rillig
62ff1c97a7
indent: test block comments and the -bbb option
2023-06-18 07:29:36 +00:00
rillig
926f8bd544
indent: remove support for backspace in code and comments
...
The C code in the whole tree does not contain a single literal
backspace.
2023-06-18 07:10:24 +00:00
rillig
65e3242c1e
tests/indent: add miscellaneous test cases found during clean up
2023-06-17 22:09:24 +00:00
rillig
abc3274d3a
indent: merge lexer symbols for type in/outside parentheses
2023-06-16 23:51:31 +00:00
rillig
95820b5370
tests/indent: format stderr output as end-of-line comments
...
This generates fewer error markers in syntax-aware editors.
2023-06-16 23:19:01 +00:00
rillig
398514d353
indent: fix spacing between postfix operator and left parenthesis
2023-06-16 23:07:52 +00:00
rillig
2fbaf64cd1
indent: improve heuristics for cast expressions
2023-06-16 14:26:26 +00:00
rillig
12ea422e44
indent: improve heuristics for cast expressions
2023-06-16 14:12:10 +00:00
rillig
961876df93
tests/indent: add a few code snippets from usr.bin/xlint
2023-06-16 13:43:30 +00:00
rillig
44e3c9f8ad
indent: improve heuristics for casts
2023-06-16 12:55:57 +00:00
rillig
7983032213
indent: fix indentation and linebreaks in typedef declarations
2023-06-16 12:30:45 +00:00
rillig
128159d42b
tests/indent: demonstrate wrong tokenization after typedef
...
Since 2023-06-10 06:52, which fixed the indentation of C11 _Generic
expressions.
2023-06-16 11:58:33 +00:00
rillig
8535e877f0
indent: don't force a blank line between '}' and preprocessing line
2023-06-16 11:48:32 +00:00
rillig
14063fa4b7
indent: fix indentation of multi-line enum constant initializers
2023-06-15 10:34:12 +00:00
rillig
0982fd88d1
indent: miscellaneous cleanups, more tests for edge cases
2023-06-15 09:19:06 +00:00
rillig
f0cb29371b
indent: fix alignment of multi-line declarations
2023-06-15 08:40:20 +00:00
rillig
940b85009c
indent: clean up the code, add a few tests
2023-06-14 20:46:08 +00:00
rillig
cdfe968337
indent: allow more than 128 brace levels
2023-06-14 19:05:40 +00:00
rillig
ca9074275c
tests/indent: separate stdout from stderr
...
Due to buffering, there was no guarantee that the output would be
exactly in the same order as written in the tests.
2023-06-14 17:07:32 +00:00
rillig
641fe74526
indent: allow more than 20 nested parentheses or brackets
2023-06-14 14:11:28 +00:00
rillig
ddbd65a192
indent: fix formatting of comment after 'switch (expr)'
2023-06-14 11:18:09 +00:00
rillig
557ed6ed5d
indent: use correct preprocessing directive in error message
2023-06-14 10:29:52 +00:00
rillig
d2103f1c62
indent: allow more than 5 levels of #if/#endif
2023-06-14 10:26:00 +00:00
rillig
ed7b435925
indent: clean up handling of comments
...
One less moving part in the parser state.
No functional change.
2023-06-14 09:31:05 +00:00
rillig
61c5d6b6d0
indent: remove a redundant flag from the parser state
...
No functional change.
2023-06-14 08:25:15 +00:00
rillig
b2fe5a24a1
indent: merge parser symbols for stmt and stmt_list
...
They were handled in exactly the same way.
2023-06-14 07:20:54 +00:00
rillig
bae713c412
indent: fix line break between semicolon and brace
2023-06-10 18:46:42 +00:00
rillig
3d124ccbbf
tests/indent: add move coverage tests
2023-06-10 17:56:29 +00:00
rillig
8bcc07836b
indent: fix stack overflow, add more tests
...
For several parser symbols, 2 symbols are pushed in a row, which led to
an out-of-bounds write.
2023-06-10 17:35:40 +00:00
rillig
b3bf029a38
indent: miscellaneous cleanups
2023-06-10 16:43:55 +00:00
rillig
f6ead5d9af
indent: fix indentation of continuation lines in initializers
2023-06-10 08:17:04 +00:00
rillig
334e4e757d
indent: explain right-aligned code
2023-06-10 07:05:18 +00:00
rillig
f74eb54815
indent: fix token classification in declarations
...
As a side effect, indent handles _Generic from C11 properly now, at
least in -nlp mode.
2023-06-10 06:52:35 +00:00
rillig
338e471fd4
indent: rename and sort variables in parser state
...
No functional change.
2023-06-10 06:38:20 +00:00
rillig
d3be4ec43d
indent: trim trailing blank lines
2023-06-09 22:01:26 +00:00
rillig
1fc3c56ecf
indent: support C99 compound literals
2023-06-09 11:22:31 +00:00
rillig
ae40ebbc6b
indent: don't treat function call expressions as cast expressions
2023-06-09 10:24:55 +00:00
rillig
1f304706fb
indent: improve heuristics for function declaration vs. definition
2023-06-09 09:49:07 +00:00
rillig
1cc572504b
tests/indent: add real-life test cases from make(1) and lint(1)
2023-06-09 09:45:55 +00:00
rillig
eace873087
indent: when an indentation is ambiguous, indent one level further
...
The '-eei' mode now applies whenever the indentation from a multi-line
expression could be confused with a following statement.
2023-06-09 08:10:58 +00:00
rillig
2a0d16ddf2
tests/indent: test extra indentation in expressions
2023-06-09 07:54:05 +00:00
rillig
0fcafc89fc
indent: preserve block comments with delimiters
2023-06-09 07:18:52 +00:00
rillig
5187119b0e
indent: indent multi-line expressions according to parentheses
...
This reverts the FreeBSD change from 2004-02-12 that had been imported
on 2019-04-04.
2023-06-09 06:36:57 +00:00
rillig
7171fe25bf
indent: remove fragile heuristic for detecting cast expressions
...
The assumption that in an expression of the form '(a * anything)', the
'*' marks a pointer type was too simple-minded.
For now, fix the obvious cases and leave the others for later. If
needed, they can be worked around using the '-T' option.
2023-06-08 21:18:54 +00:00
rillig
5df2816aac
indent: fix indentation of initializer lists with designators
2023-06-08 20:55:22 +00:00
rillig
cfb043929d
tests/indent: add more tests, from indent's own code
2023-06-08 20:49:04 +00:00
rillig
6b78dc3375
indent: fix indentation in multi-line else-if conditions
2023-06-08 20:36:35 +00:00
rillig
0663d70d1e
tests/indent: extend test for wrong indentation in 'else if'
2023-06-08 20:28:50 +00:00
rillig
41e7f68d7c
indent: clean up and condense code
...
No functional change.
2023-06-08 06:47:13 +00:00
rillig
9f9251e958
indent: right-trim single-line comments
2023-06-06 07:51:35 +00:00
rillig
5bf8b14793
tests/indent: comments with trailing whitespace may fit in a single line
2023-06-06 05:39:49 +00:00
rillig
6da4319099
indent: compute indentation of 'case' labels on-demand
...
One less moving part to keep track of.
No functional change.
2023-06-06 04:37:26 +00:00
rillig
e14544c8e6
tests/indent: add test for left-justifying declarations
2023-06-05 15:02:54 +00:00
rillig
9a8371330c
indent: don't remove blank line after 'if (expr) {'
2023-06-05 12:01:33 +00:00
rillig
24133b796d
indent: do not report broken lines, report configuration on stderr
2023-06-05 10:12:21 +00:00
rillig
abcf191e28
indent: fix formatting of 'do' statements
2023-06-05 09:41:40 +00:00
rillig
b33c0a568f
indent: fix trailing whitespace after comment
2023-06-05 08:22:00 +00:00
rillig
452673c116
tests/indent: add tests for 'do-while' loops
2023-06-05 08:10:25 +00:00
rillig
a28f6dc620
indent: clean up handling of whitespace
...
No functional change.
2023-06-05 07:23:03 +00:00
rillig
f38db2caee
indent: do not parse '&&&&&&&' as a single binary operator
2023-06-04 22:57:18 +00:00
rillig
6bf97c9eba
indent: fix '*=' to be a binary operator, not a unary one
2023-06-04 22:36:10 +00:00
rillig
e071ed3c05
tests/indent: cover code in lexi.c
2023-06-04 22:20:04 +00:00
chs
3f4a55cf50
The ATF design is O(N^2) in the number of TCs in one TP, which on some
...
slower platforms causes the net/ipsec tests to take as much as 30% of
the total time to run all of the ATF tests. Reduce the number of TCs
in various net/ipsec TPs by iterating over *_ALGORITHMS_MINIMUM rather
than *_ALGORITHMS. Various of the net/ipsec tests already use the
smaller lists, so change the rest of them to do so as well.
2023-06-04 22:18:47 +00:00
rillig
f84beafc1f
tests/indent: clean up comments
2023-06-04 19:28:54 +00:00
rillig
3540994a6c
indent: force at least one space after the colon of a label
2023-06-04 18:58:30 +00:00
rillig
43aa4f997a
indent: rename struct field, for better symmetry
...
No binary change outside debug mode.
2023-06-04 14:20:00 +00:00
rillig
2c1771512e
indent: fix indentation of initializers in compound expressions
2023-06-04 13:49:00 +00:00
rillig
1f543254ee
indent: fix formatting of compound expressions, at least partially
2023-06-04 13:26:06 +00:00
rillig
08090a1872
lint: use separate lexer symbols for 'case' and 'default'
...
It's not strictly necessary since these tokens behave in the same way,
still, the code is more straight-forward when there are separate tokens.
2023-06-04 12:46:57 +00:00
rillig
27051cd2e2
indent: classify 'inline' as a modifier rather than a word
2023-06-04 11:45:00 +00:00
joerg
3caa8dc735
Fix interactions of initial-exec TLS model and dlopen
...
(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of the static TLS offset used the wrong DSO.
This would effectively mean the wrong address was computed
(PR toolchain/50277, PR pkg/57445).
Fix this by forcing the computation of the correct DSO (the one defining
the symbol).
This code uses __UNCONST to avoid the vast interface changes for this
special case.
(2) If symbols from a DSO loaded via dlopen are used with both
global-dynamic/local-dynamic and initial-exec relocations AND
a initial-exec relocation was resolved first in a thread, a split brain
situation could exist where the dynamic relocations would use one memory
block (separate allocation) and the initial-exec relocations the static
per-thread TLS space.
(3) If the initial-exec relocation in (2) is seen after any thread has
already used a GD/LD allocation, bail out. Since IE relocations are used
only in the GOT, this will prevent the dlopen. This is a bit more
aggressive than necessary, but a full blown reference counting doesn't
seem to be justified.
2023-06-04 01:24:56 +00:00
rillig
0bee435acd
indent: fix indentation of adjacent '{'
2023-06-03 21:44:08 +00:00
lukem
58beaa2b43
adapt to ${CC_WNO_MAYBE_UNINITIALIZED}
...
Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.
Remove workarounds if they were for a specific
version of gcc < 10.
2023-06-03 21:31:45 +00:00
lukem
1a214827c2
adapt to ${CC_WNO_FORMAT_TRUNCATION}
2023-06-03 21:28:52 +00:00
rillig
79e55a0f42
lint: add query for static variables in functions
...
This query allows finding hidden global variables, as an easier-to-read
alternative to 'objdump -t'.
2023-06-03 21:08:06 +00:00
rillig
f9624b3c8d
lint: provide more detailed types when operands do not match
2023-06-03 20:28:54 +00:00
lukem
c4b7a9e794
bsd.own.mk: rename GCC_NO_* to CC_WNO_*
...
Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.
GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH
Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
lukem
f937c412f3
bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER
...
Provide a single variable
CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
CLANG_NO_ADDR_OF_PACKED_MEMBER
CC_NO_ADDR_OF_PACKED_MEMBER
GCC_NO_ADDR_OF_PACKED_MEMBER
Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 08:52:53 +00:00
riastradh
067c5136b3
ld.elf_so: Test dynamic-then-static abuse via ctor.
...
XXX pullup-10
2023-06-02 19:09:11 +00:00
riastradh
f4e534dd53
ld.elf_so: Test another edge case of mismatched TLS models.
...
One library defines a symbol and _doesn't_ use it, so it has no
indication of whether the symbol is for static TLS or dynamic TLS,
and then two other libraries use it in different ways.
XXX pullup-10
2023-06-02 19:08:48 +00:00
riastradh
4dedd5fc26
ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently.
...
If a symbol has already been resolved as dynamic TLS, any library
that tries to use it as static TLS cannot be dlopened.
XXX pullup-10
2023-06-02 19:08:01 +00:00
rillig
3eeca426f5
indent: force each statement on a new line
...
Previously, '{} while (cond)' was kept on a single line, even though the
'while' was independent of the '{}'.
2023-06-02 15:07:46 +00:00
rillig
9e6f62d1d8
indent: remove newline between 'switch' and '{'
2023-06-02 14:34:14 +00:00
rillig
6fc430af5c
indent: improve heuristics of classifying '*' as pointer or operator
2023-06-02 14:21:55 +00:00
rillig
ef25c88e9b
indent: clean up
...
Only print the 'token' buffer in debug mode if it is interesting, group
the blocks in handling of '(' tokens by topic, remove obsolete comment
from test.
2023-06-02 13:59:33 +00:00
rillig
a565c86f6c
indent: fix formatting of declarations with preprocessing lines
2023-06-02 11:43:07 +00:00
rillig
7511320300
tests/indent: demonstrate bugs when formatting preprocessing lines
2023-06-02 11:26:21 +00:00
andvar
cb40c69b16
follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
...
also s/beyound/beyond/ and few others along the way, mainly in comments.
2023-06-02 08:51:46 +00:00
riastradh
98256cacf3
ld.elf_so: Separately test eager and lazy resolution of def tls ptr.
...
eager: before loading use library
lazy: after loading use library
XXX pullup-10
2023-06-01 23:47:24 +00:00
riastradh
e04ffa379b
ld.elf_so: Shorter test names.
...
No functional non-cosmetic change intended.
XXX pullup-10
2023-06-01 22:26:51 +00:00
riastradh
6b7ae3bea1
ld.elf_so: Test TLS abuse of static def, dynamic use and vice versa.
...
XXX pullup-10
2023-06-01 22:26:40 +00:00
riastradh
bc9d9d1143
ld.elf_so: Factor out logic in TLS tests to make writing more easier.
...
No functional change intended.
XXX pullup-10
2023-06-01 22:24:52 +00:00
riastradh
05e97b5a42
ld.elf_so: Test extern dynamic TLS too.
...
XXX pullup-10
2023-06-01 20:50:18 +00:00
riastradh
f4e155a450
ld.elf_so: Test variations on PR toolchain/50277.
...
XXX pullup-10
2023-06-01 20:48:30 +00:00
riastradh
fca22ba5cb
ld.elf_so: Nix inadvertently committed private test program.
2023-05-31 01:06:43 +00:00
riastradh
111bb99c35
ld.elf_so: Fix extern TLS test to match PR toolchain/50277.
...
Now it's actually testing the problem.
2023-05-31 00:46:11 +00:00
riastradh
12037d6a69
ld.elf_so: New test for extern initial-exec TLS, PR toolchain/50277.
...
XXX pullup-10
2023-05-31 00:18:44 +00:00
hannken
b3a4996943
Add RUMPHIJACK option "blanket=/DEV" so mount_ffs may canonicalise
...
and mount the device path. Cannot use "/rump/DEV" here as the device
path is embedded in "struct ufs_args" where it doesnt get hijacked.
2023-05-28 08:17:00 +00:00
christos
562596981f
match the new compiler warning
2023-05-24 20:02:34 +00:00
christos
c59fd10753
no more md5 for you.
2023-05-24 18:22:05 +00:00
rillig
e9b5780b33
indent: fix indentation of struct declarations
2023-05-23 16:53:57 +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
3368225913
tests/indent: add code snippets found in make and lint1
2023-05-23 06:18:00 +00:00
rillig
8bd40c7adb
indent: fix spacing between block braces
2023-05-22 23:03:16 +00:00
rillig
9bf982382f
tests/indent: refine a few tests
2023-05-22 23:01:27 +00:00
rillig
27a3cefcf0
tests/lint1: allow whitespace in files containing the expected output
...
This reduces the amount of wizardry needed to interpret the files. For
a more gentle introduction of the file format, see ../lint2/msg_000.ln.
The whitespace that is removed is very similar to the one in the lint2
tests, the difference is that '%<space>' and '%#' need to be preserved
in abbreviated printf and scanf format strings.
2023-05-22 20:11:24 +00:00
rillig
960cfb1b4e
lint: fix emitted type for arrays of unknown size
2023-05-22 17:53: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
9379c1663f
tests/lint: demonstrate wrong emitted array length in initialization
...
Seen in usr.bin/indent/debug.c, in the various 'name' arrays.
2023-05-22 11:51:46 +00:00
rillig
b95ee04d96
indent: implement suppressing optional blank lines
2023-05-22 10:28:59 +00:00
rillig
0df62e5bf6
tests/indent: skip creating an intermediate file in tests
2023-05-22 06:35:56 +00:00
andvar
e7745f3aff
s/thar/that/ in comments.
2023-05-21 18:01:38 +00:00
rillig
c99fb69e72
tests/indent: fix outdated or wrong comments
2023-05-21 10:18:44 +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
89b72942a5
tests/indent: prevent 'indent end' with arguments
2023-05-20 22:08:07 +00:00
rillig
a9183f83be
tests/indent: migrate test driver from AWK to Lua
...
Lua reports more details when os.execute fails, which is useful when
running old versions of indent for comparison. The new test driver also
supports multiple test files in the same run.
2023-05-20 21:32:05 +00:00
rillig
04185e831b
tests/indent: clean up test driver
...
No functional change.
2023-05-20 17:31:53 +00:00
rillig
fe2fb3c8db
indent: don't insert blank line between two closing lines
2023-05-20 12:05:01 +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
895746d7ed
tests/indent: test multi-line comments with -ncdb
2023-05-19 07:05:26 +00:00
rillig
d46fdfe393
indent: document the funcname token
2023-05-18 08:09:28 +00:00
rillig
2d18db1bfc
indent: manually wrap overly long lines
...
No functional change.
2023-05-18 05:33:27 +00:00
gutteridge
b1f970ed17
t_ptm.c: add a test case that passes extra flags
...
Validate that O_NONBLOCK and O_CLOEXEC are actually set by
posix_openpt(3), as until circa 9.99.101 they were not.
If/when other flags are added like close-on-fork, this test could be
adjusted. The current concern is with supporting the expectations of
components like vte3, used by various graphical terminal clients.
2023-05-17 03:16:11 +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
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
a59ea3192b
indent: fix duplicate space between comment and binary operator
2023-05-15 20:30:20 +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
rillig
3357d7dc84
tests/indent: test type detection
2023-05-15 17:51:49 +00:00
rillig
2e1f799d6b
indent: remove accidental space before tab
2023-05-15 17:38:56 +00:00
rillig
3842fd14e5
indent: remove backslash line continuation outside preprocessing
...
The indenter did not handle these backslashes well, interpreting them as
unary operators, and they are an edge case anyway. Line continuations
in string literals and character constants are kept.
2023-05-15 17:28:14 +00:00
rillig
c3a01c7bfa
tests/indent: demonstrate wrong spacing after function prototype
2023-05-15 15:04:48 +00:00
rillig
6c38484f82
indent: fix spacing between function prototype and attributes
2023-05-15 14:55:47 +00:00
rillig
c74302075d
indent: fix indentation of struct member names
2023-05-15 14:12:03 +00:00
rillig
415b6afa14
tests/indent: demonstrate wrong indentation of struct members
2023-05-15 13:53:32 +00:00
rillig
b33d7ae266
indent: fix indentation of statements after controlling expression
2023-05-15 13:33:19 +00:00
rillig
60722870c9
tests/indent: add another test for -eei -nlp
2023-05-15 13:28:05 +00:00
rillig
8bbe0ac207
indent: fix indentation of expressions in -nlp -eei mode
2023-05-15 12:59:43 +00:00
rillig
3801fbef33
tests/indent: test extra indentation with fixed continuation indentation
2023-05-15 12:11:07 +00:00
rillig
09166ed3ac
indent: fix indentation of multi-line '?:' expressions in functions
2023-05-15 10:13:40 +00:00
rillig
e311e1f8e6
tests/indent: -badp should not add blank lines in initializers
2023-05-15 09:05:08 +00:00
rillig
89e0e636cf
indent: fix spacing in for loop with declaration (since 2022-02-13)
2023-05-15 08:56:39 +00:00
rillig
f382e6fe26
tests/indent: demonstrate wrong spacing in for loops
2023-05-15 08:22:23 +00:00
rillig
9a2185a149
indent: clean up memory and buffer management
...
Remove the need to explicitly initialize the buffers. To avoid
subtracting null pointers or comparing them using '<', migrate the
buffers from the (start, end) form to the (start, len) form. This form
also avoids inconsistencies in whether 'buf.e == buf.s' or 'buf.s ==
buf.e' is used.
Make buffer.st const, to avoid accidental modification of the buffer's
content.
Replace '*buf.e++ = ch' with buf_add_char, to avoid having to keep track
how much unwritten space is left in the buffer. Remove all safety
margins, that is, no more unchecked access to buf.st[-1] or appending
using '*buf.e++'.
Fix line number counting in lex_word for words that contain line breaks.
No functional change.
2023-05-15 07:28:45 +00:00
rillig
506e3bec5c
indent: only null-terminate the buffers if necessary
...
The only case where a buffer is used as a C-style string is when looking
up a keyword.
No functional change.
2023-05-14 22:26:37 +00:00
rillig
1304bdca7f
indent: fix handling of multiple block comments in a line
2023-05-14 17:53:38 +00:00
rillig
217e4d847d
indent: in comments, keep a leading tab
...
This kind of comments is used for the CVS IDs at the top of files.
2023-05-14 17:13:37 +00:00
rillig
0cd0431ee6
indent: fix vertical spacing after declarations
...
A comment is not supposed to change the state of the 'blank line after
declaration', but it did. The initialization of saved_just_saw_decl was
wrong though since it tried to capture the previous value after it had
already been overwritten.
2023-05-14 16:47:06 +00:00
rillig
e04d6833e7
indent: miscellaneous cleanups
2023-05-14 11:29:23 +00:00
rillig
4f2a635091
lint: add query for chained assignments
2023-05-13 20:55:44 +00:00
riastradh
1e9b358f6a
openssl: More tests need -Wno-missing-field-initializers.
2023-05-13 17:46:09 +00:00
rillig
c49e59f750
indent: do not add a space before a comment that starts a line
2023-05-13 16:40:18 +00:00
rillig
2261e976c8
indent: implement 'blank after declarations'
2023-05-13 15:34:22 +00:00
riastradh
61b8d55f2a
openssl: libcrypto bf test needs -Wno-missing-field-initializers
2023-05-13 15:12:13 +00:00
rillig
4cae730b26
tests/indent: extend test for blank line after declaration
2023-05-13 14:19:14 +00:00
rillig
24dd152d37
indent: fix lexing of numbers that are spread over multiple lines
2023-05-13 13:31:37 +00:00
rillig
9db90c6e6b
tests/indent: add test for lexing of numbers
2023-05-13 13:24:01 +00:00
rillig
842f73039b
indent: clean up a condition, add comments
...
No functional change.
2023-05-13 09:40:47 +00:00
rillig
38caea9b89
indent: preserve indentation of preprocessor directives
2023-05-13 08:33:39 +00:00
rillig
ff059387ed
tests/indent: explain, clean up and add some tests
2023-05-13 06:52:48 +00:00
rillig
8ba922e8f2
tests/indent: test pushing the placeholder symbol to the parser stack
2023-05-12 22:36:15 +00:00
rillig
0cdf93c9f3
indent: remove statistics
...
The numbers from the statistics were wrong.
2023-05-12 10:53:33 +00:00
rillig
46afda1643
tests/indent: test interaction between preprocessing and comments
2023-05-11 21:36:31 +00:00
rillig
d5678748c0
indent: don't touch comments in preprocessing lines
...
The indentation of multi-line comments was wrong, and the code for
handling them was too complicated.
2023-05-11 19:01:35 +00:00
rillig
bacb7fc4b5
tests/indent: add more tests for preprocessing directives
2023-05-11 18:44:14 +00:00
rillig
5300eef1a9
tests/indent: test multi-line comments in preprocessing lines
2023-05-11 18:36:36 +00:00
rillig
d54ae284ce
indent: remove broken code for handling blank lines
...
This fixes several bugs where blank lines were erroneously added or
removed, treating these old bugs for new bugs in different places.
These new bugs are expected to be easier to fix, as the old bugs will
not interfere anymore.
2023-05-11 18:13:55 +00:00
rillig
3ae5a30b3c
indent: add debug output for tracking comments and braces
2023-05-11 17:22:56 +00:00
christos
a09aac5f84
aarch64 needs static
2023-05-11 14:34:30 +00:00
rillig
44c1f7b6a8
indent: remove unnecessary assignments to last_else
...
No functional change intended.
2023-05-11 10:39:25 +00:00
kre
490e17a0c9
Fix building the debugging tarball of the directory tree created for
...
the pathname matching tests ... this is not used in any way in a normal
test run, but if there are problems, one needs a mechanism to discover
whether the issue is with the code that creates the directory tree in the
test, or with the matching (either what the test expects to happen, or
what the shell actually does). The couple of lines being fixed here make
that mechanism work --- I have had this in my private sources for years
now, but never got around to committing it. It is time. NFC for any
normal test run.
2023-05-11 10:08:34 +00:00
rillig
373317666b
indent: remove buggy code for swapping tokens
...
It is not the job of an indenter to swap tokens, even if it's only about
placing comments elsewhere. The code that swapped the tokens was
complicated, buggy and impossible to understand.
In -br (brace right) mode, indent no longer moves a '{' from the
beginning of a line to the end of the previous line, as that was handled
by the token swapping code as well. This change is unintended, but it
will be easier to re-add that now that the code is simpler.
2023-05-11 09:28:53 +00:00
rillig
0510ee8e2a
lint: fix type name in diagnostic for enum as controlling expression
...
Previously, the type was reported as 'int' instead of 'enum'.
Continue to only report the type simple for pointer types, as the exact
pointer type is irrelevant to this message.
2023-05-11 08:01:36 +00:00
gutteridge
1b3c330bb0
t_fss.sh: add missing test case head
2023-05-11 01:56:31 +00:00
gutteridge
7cb4398ae9
t_patterns.sh: fix naming of head() of filename_expansion
2023-05-11 01:50:40 +00:00
gutteridge
3d108ca492
t_cmdsub.sh: fix naming of head() of cmdsub_paren_tests
2023-05-11 00:32:48 +00:00
gutteridge
360a298dc1
t_getopt.sh: fix naming of head() of getopt_optval test case
2023-05-10 23:44:15 +00:00
rillig
a48523a624
lint: track integer constraints through conditional expressions
2023-05-09 15:51:33 +00:00
rillig
872d56a969
lint: preserve integer constraints on cast
2023-05-09 15:45:06 +00:00
rillig
b889b215f6
tests/lint: demonstrate wrong warning about loss of accuracy
2023-05-09 15:37:29 +00:00
rillig
815f75fc84
tests/lint: demonstrate wrong warning about losing accuracy
2023-05-09 14:46:36 +00:00
andvar
e171cef674
fix the grammar in comments reported by Jim Spath in misc/57397.
2023-05-08 19:23:45 +00:00
christos
59a49c3ac2
make tests support both 1.x and 3.x.
...
Lot of work needed to add all the 3.x tests, but that can wait until all
is switched
2023-05-08 17:46:06 +00:00
skrll
75b842b847
RISC-V support that works on QEMU with a single hart.
...
Thanks for Simon Burge for plic(4).
2023-05-07 12:41:45 +00:00
gutteridge
09bc0ce2d8
t_sed.sh: add a test case for relative addressing
...
At one time, this didn't always work correctly, per PR bin/49109. Test
case from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192108
2023-05-06 02:12:11 +00:00
gutteridge
f12d9a9c2d
t_sed.sh: fix grammar, spelling, and formatting issues (NFC)
2023-05-06 02:07:42 +00:00
gutteridge
9e739a8449
t_trapsignal.sh: fix head() function definitions of test cases
2023-05-05 01:27:18 +00:00
gutteridge
3a6eaa3511
t_fexecve.sh: fix head() function definitions of test cases
2023-05-04 00:02:10 +00:00
gutteridge
55843ced06
t_expr.sh: fix naming of head() of lang test case
2023-05-02 00:11:27 +00:00
rillig
0878a3d7ee
lint: reword message for missing declaration in header
...
Suggested by Christos.
2023-04-25 19:00:57 +00:00
uwe
c9764f2dff
tests/rump/modautoload: reorder -lrumpvfs_nofifofs
...
Make the way we spell "-lrumpvfs -lrumpvfs_nofifofs" hack consistent.
The order doesn't matter here because of --whole-archive.
2023-04-24 20:55:53 +00:00
uwe
1694588bdd
tests: trim down the list of LIBRUMPBASE libraries
...
Now that cyclic dependencies are (mostly) broken, we can drop repeated
-l instances that worked around those cycles. Links on sun2.
2023-04-24 20:35:49 +00:00
mlelstv
7d5fef3b2c
Allow 24bit support.
2023-04-23 16:49:38 +00:00
rillig
951d064816
tests/lint: add rationale for not warning about alignment problems
2023-04-23 11:52:43 +00:00
rillig
f0ae73e148
lint: be strict when parsing command line for excluded message IDs
...
Previously, lint accepted -X '1, 2, 3', while the manual page lists the
IDs without spaces.
On 32-bit platforms, lint accepted -X -4294967295, and on 64-bit
platforms, it accepted the corresponding larger numbers.
The code for parsing message IDs and query IDs conceptually does the
same, but the implementations differed for no reason.
2023-04-23 09:04:44 +00:00
rillig
1d3cf26e0d
tests/lint: test command line parsing for message and query IDs
...
The parsing methods differ but shouldn't.
2023-04-23 08:47:27 +00:00
gutteridge
212fac277d
t_open_pr_57260.c: KNF a block (spaces to tabs)
2023-04-23 00:46:46 +00:00
rillig
6b952c1471
lint: allow cast from a type to a union containing that type
2023-04-22 20:54:28 +00:00
rillig
368afe279d
lint: fix wrong warning about 'extern' temporary identifier
2023-04-22 20:27:09 +00:00
rillig
da9016a31f
tests/lint: demonstrate wrong warning about extern temporary identifier
2023-04-22 20:21:13 +00:00
rillig
a143ec617b
tests/lint: test cast to union with stricter alignment
2023-04-22 19:45:04 +00:00
rillig
b847195210
lint: don't warn about cast between union and one of its member types
...
Seen in src/sbin/newfs_udf/udf_core.c for context.anchors.
2023-04-22 17:42:29 +00:00
rillig
0e61302acd
tests/lint: add test for conversions to and from a union type
...
Additionally, fix the line numbers in another test.
2023-04-22 17:30:35 +00:00