On 2/15/23 15:11, Laszlo Ersek wrote:
We intend to place a space character between the function designator
and
the opening parenthesis in a function call. We've been executing on that
mostly consistently; fix the few exceptions now.
The same convention should be applied to the invocations of function-like
macros, and to instances of "__attribute__ ((attr))". (The latter is
exemplified, although not consistently, by the GCC manual.) Implement
this, by inserting the necessary spaces.
Furthermore, some compiler attributes take multiple parameters, such as
"nonnull". The GCC manual clearly shows that arguments passed to such
attributes may be separated with ", " as well, not just ",". Use the
former, as it's more readable.
Finally, the C standard calls "defined" -- as in "#if defined
identifier"
and (equivalently) "#if defined (identifier)" -- a unary preprocessing
operator. We can spell the parenthesized form as "defined (identifier)"
rather than "defined(identifier)", so choose the former.
I collected the locations possibly missing spaces with:
git grep -EHn '\<[a-zA-Z0-9_]+\(' -- '*.c' '*.h'
and then manually updated each as necessary.
I didn't change occurrences in comments, except where the comment clearly
indicated copying and pasting an expression into new code.
"git show -w" outputs nothing for this patch.
The test suite passes.
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
lib/internal.h | 72 ++++++++++----------
lib/nbd-protocol.h | 12 ++--
common/include/array-size.h | 2 +-
common/include/byte-swapping.h | 24 +++----
common/include/checked-overflow.h | 42 ++++++------
common/include/compiler-macros.h | 2 +-
common/include/iszero.h | 2 +-
common/include/minmax.h | 4 +-
common/utils/const-string-vector.h | 2 +-
common/utils/nbdkit-string.h | 2 +-
common/utils/string-vector.h | 2 +-
common/utils/vector.h | 20 +++---
lib/errors.c | 6 +-
lib/opt.c | 4 +-
lib/uri.c | 2 +-
lib/utils.c | 12 ++--
common/include/test-array-size.c | 26 +++----
common/utils/test-human-size.c | 10 +--
common/utils/test-vector.c | 4 +-
ocaml/nbd-c.h | 6 +-
tests/eflags.c | 6 +-
tests/get-size.c | 4 +-
tests/newstyle-limited.c | 6 +-
tests/oldstyle.c | 4 +-
examples/copy-libev.c | 30 ++++----
examples/list-exports.c | 2 +-
examples/strict-structured-reads.c | 2 +-
examples/threaded-reads-and-writes.c | 2 +-
interop/interop.c | 2 +-
copy/file-ops.c | 2 +-
copy/main.c | 2 +-
copy/nbdcopy.h | 2 +-
dump/dump.c | 2 +-
fuse/nbdfuse.c | 2 +-
info/main.c | 2 +-
ublk/nbdublk.c | 4 +-
ublk/tgt.c | 20 +++---
37 files changed, 175 insertions(+), 175 deletions(-)
Merged this patch as commit b5101fbc59cb ("use space consistently in
function and function-like macro invocations", 2023-02-22), with Eric's
R-b from this thread, and with Rich's R-b from under patch#04.
A longer-term subset of the new or newly highlighted tasks I've recorded
in another commit: 46d60f807eca ("TODO: coding style and nbdkit code
sharing ideas", 2023-02-22).
The more direct tasks I've captured in
<
https://bugzilla.redhat.com/show_bug.cgi?id=2172516>.
Laszlo