Commit Graph

22 Commits

Author SHA1 Message Date
sjg e56a2ae17f Fix some unused warnings 2022-03-04 23:17:16 +00:00
rillig b310848a9c make: remove redundant comments for multiple-inclusion guards 2021-12-15 12:08:25 +00:00
rillig cc821a91f9 make: fix lint warnings
The string functions from str.h are declared as 'static __unused' when
compiled with GCC, but lint explicitly undefines __GCC__ during
preprocessing.  Therefore, make those functions inline, to prevent
warnings that they are unused.

The macro UNCONST is used in a few places, and (again) since lint
undefines __GCC__, that macro expanded to a simple type cast, which lint
warned about.  To prevent this warning, implement UNCONST as a function
that works everywhere and hides the type cast.

In filemon_open, the code for closing F->in was obviously unreachable.

No functional change.
2021-07-31 09:30:17 +00:00
rillig ad72e4a282 make: document the syscalls that are not monitored by filemon_ktrace 2021-02-01 21:34:41 +00:00
rillig 69d4726f64 make: indent preprocessor directives consistently
As seen in share/misc/style.
2021-02-01 21:09:25 +00:00
rillig 85aee7a6f7 make(1): remove do-not-format markers from comments
These markers had been used inconsistently.  Furthermore the source code
had not been formatted automatically before 2020 at all, otherwise there
wouldn't have been any trailing whitespace left.
2021-01-19 20:51:46 +00:00
rillig 810790fcb7 make(1): make a few more bool expressions more precise
The previous version of lint(1) from a few hours ago didn't catch all
occurrences.  And even the current one doesn't catch everything.
Function arguments and return types still need some work.  The "return
quietly" from shouldDieQuietly still implicitly converts from int to
_Bool.

No functional change.
2021-01-10 23:59:53 +00:00
rillig 31940a95cd make(1): consistently use boolean expressions in conditions
Most of the make code already followed the style of explicitly writing
(ptr != NULL) instead of the shorter (ptr) in conditions.

The remaining 50 instances have been found by an experimental,
unpublished check in lint(1) that treats bool expressions as
incompatible to any other scalar type, just as in Java, C#, Pascal and
several other languages.

The only unsafe operation on Boolean that is left over is (flags &
FLAG), for an enum implementing a bit set.  If Boolean is an ordinary
integer type (the default), some high bits may get lost.  But if Boolean
is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2
defines that a conversion from any scalar to the type _Bool acts as a
comparison to 0, which cannot lose any bits.
2021-01-10 21:20:46 +00:00
rillig 462cbdfa37 make(1): fix lint warnings 2021-01-09 16:06:09 +00:00
rillig 71c58e78f7 make(1): replace pointers in controlling conditions with booleans 2020-12-31 17:39:36 +00:00
rillig 84085cca68 make(1): use space instead of tab for preprocessor directives 2020-11-29 09:27:40 +00:00
rillig b136e34b03 make(1): remove unused label 2020-11-28 16:31:34 +00:00
rillig 4adbce360a make(1): use comparisons in boolean expressions
The generated code stays exactly the same.
2020-11-23 23:41:11 +00:00
rillig 7179b788e7 make(1): align end-of-line comments with tabs 2020-11-23 20:41:20 +00:00
rillig 143a32671d make(1): remove redundant parentheses from sizeof operator
The parentheses are only needed if the argument is a type, not an
expression.
2020-11-05 17:27:16 +00:00
rillig 5658125d0a make(1): prepare for WARNS=6
The FD_* macros from sys/sys/fd_set.h use signed integers on NetBSD 8
and thus produce conversion errors.  On NetBSD 9, these macros are fixed
to use 1U instead of 1.
2020-10-18 11:54:43 +00:00
rillig 78449cb4c7 make(1): use consistent include guard for headers 2020-10-18 11:49:47 +00:00
sjg 07bbd59e21 Use O_CLOEXEC and save a syscall.
Reviewed by: riastradh
2020-07-10 15:53:30 +00:00
sjg 200ecb7389 filemon_dev:filemon_open need FD_CLOEXEC
We need to mark the fd for filemon FD_CLOEXEC
so that when we call filemon_close() the device is
closed and unflushed data written to our temp file.
2020-07-10 00:42:53 +00:00
sjg b24780ba6c Rename guard to avoid that already used by Linux filemon.h
Reviewed by: riastradh
2020-01-22 22:10:36 +00:00
riastradh b8bc1cd703 Missed a spot -- define _KERNTYPES to get register_t. 2020-01-19 20:22:57 +00:00
riastradh bea0f8c176 Per sjg's suggestion, split filemon API into separate back ends.
By default we use the ktrace back end, but the /dev/filemon back end
is available as a compile-time option, by setting USE_FILEMON=dev in
make.  sjg raised concerns about ktrace performance and would like to
continue using /dev/filemon on FreeBSD (which has seen more
maintenance kernel-side) without forking make.
2020-01-19 19:49:36 +00:00