On Wed, Apr 19, 2023 at 11:53:44AM +0100, Richard W.M. Jones wrote:
On Tue, Apr 18, 2023 at 07:26:21PM +0200, Laszlo Ersek wrote:
(The changes in this patch are simple, but likely more controversial than the rest.)
The following four components don't play nice together:
- Needlessly spelling out "extern" for function declarations in header files. (C99 6.2.2p5: "If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier extern [...]".)
Well I didn't know that ...
https://stackoverflow.com/questions/18171373/why-are-some-functions-declared... gives some more interesting details (including what happens if you declare a function more than once, using different specifiers across the declarations). I'm okay with dropping extern on functions if you want, but that can be a separate patch; leaving them doesn't hurt either (other than the line length issues where your line splitting techniques are fine).
+++ b/lib/internal.h @@ -407,7 +407,9 @@ extern int nbd_internal_wait_until_connected (struct nbd_handle *h) LIBNBD_ATTRIBUTE_NONNULL (1);
/* crypto.c */ -extern struct socket *nbd_internal_crypto_create_session (struct nbd_handle *, struct socket *oldsock) +extern struct socket * + nbd_internal_crypto_create_session (struct nbd_handle *, + struct socket *oldsock) LIBNBD_ATTRIBUTE_NONNULL (1, 2);
Looks reasonable to me. emacs may have a bit of a difficulty in auto-indenting this back to the same place, but it is infrequent enough that manual override is still viable. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org