Commit Graph

288696 Commits

Author SHA1 Message Date
christos 28c1b2fc8a Account for partial writes when interrupted (from FreeBSD). 2021-07-05 07:26:00 +00:00
thorpej b13f63840e Remove unnecessary #include <sys/malloc.h> 2021-07-04 22:42:35 +00:00
thorpej 498e95a76b Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
  and just uses kmem_asprintf() to create an "irq %u" string by default.
  This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
  the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
  no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
  into a new alpha_pci_intr_alloc(), which is suitable for nearly every
  Alpha PCI platform.  Callers are expected to first have initialized
  the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
2021-07-04 22:36:43 +00:00
rillig b1bcf212c7 test/lint: demonstrate wrong warnings for 128-bit shifts 2021-07-04 20:22:31 +00:00
rillig 6fc826f48f tests/lint: align tests for argument conversion to each other 2021-07-04 17:32:24 +00:00
rillig 17d555dd84 lint: replace wrong assumption with citation from C99
No functional change.
2021-07-04 17:28:05 +00:00
rillig 469326d25e lint: document where to fix missing const in lvalue-to-rvalue
No functional change.
2021-07-04 17:16:09 +00:00
rillig 8b62008a54 lint: align messages for invalid left operand of '.' or '->' 2021-07-04 17:01:58 +00:00
rillig 090f19d307 lint: clean up new_tnode
No functional change.
2021-07-04 16:44:13 +00:00
rillig 9034303f18 libc: remove special handling for lint
In namespace.h 1.102 from 2005-07-16, the #ifndef was added to fix the
broken lint2 pass.  Somewhere between 2005 and now, lint has been
changed so that it does not need this workaround anymore.

After usr.bin/xlint/lint1/tree.c 1.303 from 2021-06-30, the #ifndef in
namespace.h caused the only warning about an implicit function
declaration in the whole NetBSD tree, in lib/libc/gen/sysconf.c:149,
where _getpagesize was not defined, but only getpagesize.
2021-07-04 16:18:50 +00:00
rillig e0f9a50771 tests/lint: fix unintended character constant in test
I originally intended to type ASCII DEL as an example of a nonprintable
character code.  The actual character that landed in the code was
instead U+2303 "house", which looks similar to the typical
representation of the DEL character.  The UTF-8 byte sequence for that
code point started with \xE2, or in octal \342.
2021-07-04 13:44:43 +00:00
rillig d0015532ff tests/lint: document why lint does not need to detect wrong types 2021-07-04 13:32:35 +00:00
rillig 12eb88ecaa lint: improve wording for incomplete struct or union 2021-07-04 13:31:10 +00:00
rillig 68c2fce363 lint: remove remaining support for lvalue casts
These had been GCC extensions until GCC 3.4, they were removed in GCC
4.0.
2021-07-04 13:14:53 +00:00
cjep 0534019bd5 LLVM RT library will actually cross-build from OpenBSD provided sufficient
limits are in place for the build user.
2021-07-04 12:57:48 +00:00
rillig eb81ba228f lint: remove support for obsolete GCC-style lvalue casts
Since GCC 4.0, a cast results in an rvalue.
2021-07-04 12:24:38 +00:00
hannken 6a7ac80c8d Add VOP_PARSEPATH to zfs control dir vnode op table. 2021-07-04 11:25:07 +00:00
hannken 65349f1465 Fix union_parsepath(), either the upper or the lower dvp may be NULL. 2021-07-04 11:24:09 +00:00
rillig 79b730c71f lint: in strict bool mode, allow mixed types in generated C code
This allows flex lexers to be run through lint in strict bool mode.
2021-07-04 09:13:59 +00:00
rillig 024372d5e0 tests/lint: re-enable test c99_bool_strict_suppressed
It had been disabled accidentally in the previous commit.
2021-07-04 08:50:26 +00:00
rillig da15f8a834 lint: include scan.c in 'make lint'
This theoretically enables strict bool mode for the few remaining code
in scan.l.  Since scan.l is not yet detected as generated code, all
interesting errors have to be suppressed though.
2021-07-04 08:49:41 +00:00
rillig d5273b4cbf lint: remove outdated assertion
Since err.c 1.12 from 2000-07-06, lint allows to suppress individual
error messages.  Suppressed error messages do not increment nerr.
Keeping nerr at 0 had triggered the assertion.
2021-07-04 08:19:05 +00:00
rillig 3020101578 tests/lint: add test for suppressing errors in strict bool mode 2021-07-04 07:50:53 +00:00
rillig 8d5c9f256b lint: in strict bool mode, continue after error message
If a controlling expression is not of type bool but of any other scalar
type, keep the expression.  Its value is still useful for control flow
analysis.

This prevents an assertion failure when running lint on the generated
scan.c, which contains a "while (1)" that does not stem from a system
header.  If it did, lint would accept it, see tn_from_system_header. But
"scan.c" is not considered a system header.  Maybe lint's definition of
a system header needs to be revisited.

After fixing this, there is another assertion failure though, so scan.c
is not yet ready to be inspected by lint.
2021-07-04 07:09:39 +00:00
skrll 68a49f39f0 Fix the logic operation for atomic_nand_{8,16,32,64}
From the gcc docs the operations are as follows

 { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // nand
 { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; }   // nand

yes, this is really rather strange.
2021-07-04 06:55:47 +00:00
rillig f075e51d8d lint: sync stdout and stderr when compiled in debug mode
If lint is compiled with -DDEBUG, its debug output goes to stdout, no
matter whether the option -d is given or not.
2021-07-04 05:49:20 +00:00
sjg 9ec9d7e560 Do not assume /tmp is safe to use if TMPDIR is set 2021-07-04 01:28:54 +00:00
rillig 1c866cb93c tests/make: make test job-output-null more portable
Previously, the test dependend on implementation details of the system's
printf command.

Thank you sjg for the detailed analysis on macOS, FreeBSD and Linux.
2021-07-03 22:39:40 +00:00
rillig 8de06dd8b6 lint: do not define 'long double' GCC builtins for traditional C 2021-07-03 21:27:48 +00:00
rillig df08ae1a2e lint: guard against segmentation fault when parsing struct
Found by afl.  The code that triggers this case is:

	struct{const}
2021-07-03 21:18:40 +00:00
rillig 101dcba48f lint: fix segmentation fault on malformed preprocessor output
# 0 ""
# 0 ""2

Found using afl, does not happen in practice though since every C
preprocessor generates balanced 'enter' (1) and 'leave' (2) events.
2021-07-03 20:54:08 +00:00
rillig 78c5135ad4 lint: make stdout unbuffered in debug mode
Some debug log messages are on stdout, others on stderr.  Make sure that
they occur in the correct order, even when the output is redirected.
2021-07-03 20:43:35 +00:00
rillig 3bb26a8d1c lint: fix assertion failure in display_expression for bool constants 2021-07-03 20:40:17 +00:00
palle 4fb067791a sun4v: request hypervisor api major version 3 for the interrupt group - should solve issues when setting up interrupts on S7 systems 2021-07-03 19:39:07 +00:00
rillig 3a6c880b9b tests/lint: fix test d_cast_init on macppc
On macppc, char == unsigned, which generated the following unintended
warnings:

d_cast_init.c(18): warning: initialization of unsigned with negative
    constant [221]
d_cast_init.c(18): warning: initialization of unsigned with negative
    constant [221]
d_cast_init.c(18): warning: initialization of unsigned with negative
    constant [221]
d_cast_init.c(18): warning: initialization of unsigned with negative
    constant [221]
2021-07-03 19:34:47 +00:00
rillig 5088bff9da tests/lint: fix test for character comparison on macppc
On macppc, char == unsigned char, which generates one more warning than
on platforms where char == signed char.
2021-07-03 19:31:22 +00:00
palle aad941665a sun4v: add support for hypervisor soft state - from OpenBSD 2021-07-03 19:18:55 +00:00
christos 208ba1ff3b Treat failed chdir/chroot for guest and chroot accounts as fatal.
Also treat failed set{e,}(u,g}id calls as fatal.
Addresses CVE-2020-7468, via FreeBSD.
2021-07-03 14:59:49 +00:00
christos 155cd70e85 PR/56246: Yuichiro Naito: gprof(1) never show call graphs when profiling
multi-threaded application
2021-07-03 14:08:55 +00:00
christos d9a86489f0 PR/56250: Michael Forney: mkstemp/mkdtemp not declared with
_POSIX_C_SOURCE=200809L
2021-07-03 14:07:13 +00:00
mlelstv 0f33224956 Return error from fd_dupopen. 2021-07-03 09:39:26 +00:00
nonaka 7b60a8407c itesio(4): Added IT8625E support. 2021-07-03 04:44:16 +00:00
rillig e6e831efb1 tests/lint: encode the array length in the diagnostic 2021-07-02 23:29:54 +00:00
rillig 645b9bd4df lint: fix initialization of array of unknown size
The size of the resulting array was computed wrong.
2021-07-02 22:46:43 +00:00
rillig 933a6ade01 tests/lint: add test for array subscripts in C99 initialization 2021-07-02 21:52:36 +00:00
rillig 70f3c407f9 lint: in strict bool mode, make (flag & FLAG) simpler
This is a tiny change in an edge case that does not occur in practice,
which is that the left-hand side of the '&' is explicitly cast to an
enum type.  The apparent "loss of information" from the deleted comment
has already been explained in the previous commit.
2021-07-02 21:22:26 +00:00
rillig 6a7428ed1f lint: no special check for unary operators in strict bool mode
All interesting constellations regarding unary operators are already
covered by the simple model from ops.def.

No functional change.
2021-07-02 18:52:20 +00:00
rillig 2910d22772 lint: document lint1_type.t_is_enum
Enum types are subject to implicit conversions, as opposed to struct,
union, pointer and function types.
2021-07-02 18:22:09 +00:00
dholland d8685b0d8e Add VOP_PARSEPATH to zfs's vnode table. "oops"
zfs not being under src/sys strikes again :-(
2021-07-02 17:14:36 +00:00
dholland 2c78619879 Regen. 2021-07-02 16:57:15 +00:00