On Tue, Dec 18, 2018 at 10:39:20AM -0500, John Ferlan wrote:
> Commit 912c6b22 modified the virCommandAddArg and virCommandAddArgPair
> to perform NULL argument checking; however, no corresponding change
> to the prototypes was made to remove the ATTRIBUTE_NONNULL, so the
> Coverity build failed. Adjust the prototypes accordingly.

This sounds wrong or at least different from the past.

We have historically still added nonnull annotations even when
having checks for NULL in the impl.  We had to explicitly disabble
the nonnull annotation when building under GCC to prevent it from
optimizing out the NULL checks. We left it enabled for STATIC_ANALYSIS
so that coverity would still report if any callers passed a NULL into
the methods.

> 
> Signed-off-by: John Ferlan <jfer...@redhat.com>
> ---
>  It's a build breaker for Coverity or anything that enables STATIC_ANALYSIS
>  so I'll push under that rule.
> 
>  src/util/vircommand.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/util/vircommand.h b/src/util/vircommand.h
> index dbf5041890..100f7a06e0 100644
> --- a/src/util/vircommand.h
> +++ b/src/util/vircommand.h
> @@ -123,7 +123,7 @@ void virCommandAddEnvPassAllowSUID(virCommandPtr cmd,
>  void virCommandAddEnvPassCommon(virCommandPtr cmd);
>  
>  void virCommandAddArg(virCommandPtr cmd,
> -                      const char *val) ATTRIBUTE_NONNULL(2);
> +                      const char *val);
>  
>  void virCommandAddArgBuffer(virCommandPtr cmd,
>                              virBufferPtr buf);
> @@ -134,8 +134,7 @@ void virCommandAddArgFormat(virCommandPtr cmd,
>  
>  void virCommandAddArgPair(virCommandPtr cmd,
>                            const char *name,
> -                          const char *val)
> -    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
> +                          const char *val);
>  
>  void virCommandAddArgSet(virCommandPtr cmd,
>                           const char *const*vals) ATTRIBUTE_NONNULL(2);

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to