On 10/12/2015 10:41 AM, Michal Privoznik wrote:
Our apibuild.py script does not cope with ATTRIBUTE_NONNULL:
Parse Error: parsing function type, ')' expected
Got token ('name', 'char')
Last token: ('name', 'char')
Token queue: [('op', '*'), ('name', 'dconnuri'),
('sep', ')')]
Line 3297 end:
Makefile:2441: recipe for target '../../docs/apibuild.py.stamp' failed
Let's drop it. Moreover, up until e17ae3ccc2dbc1400 where it was
introduced we did not really care about NULL-ity of dconnuri. And
moreover the ATTRIBUTE_NONNULL merely checks for static calls
over NULL, it won't catch the dynamic ones, where a NULL is
passed by a variable at runtime.
ACK.
(I have a fairly low opinion of ATTRIBUTE_NONNULL - at first glance it
*appears* that it should be doing something to guarantee that passed
args are non-null, but instead it is really just a hint to the
compiler's optimizer (and to static checkers like coverity) that the
programmer *thinks* there are no instances of NULL being passed in this
argument. This can result in useful checks (at runtime and during a
coverity run) being skipped. I don't remember the details, but have a
vague memory of a bug I was having trouble tracking down, and it ended
up being due to an ATTRIBUTE_NONNULL placed on an arg that *wasn't*
always non-NULL.)
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/libvirt-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index e6c8604..6e1aacd 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -3293,7 +3293,7 @@ virDomainMigrateVersion3Params(virDomainPtr domain,
}
-static int ATTRIBUTE_NONNULL(1)
+static int
virDomainMigrateCheckNotLocal(const char *dconnuri)
{
virURIPtr tempuri = NULL;