[Qemu-devel] [PATCH] osdep: work around Coverity parsing errors

Paolo Bonzini posted 1 patch 7 years, 4 months ago
Failed in applying to current master (apply log)
include/qemu/osdep.h | 8 ++++++++
1 file changed, 8 insertions(+)
[Qemu-devel] [PATCH] osdep: work around Coverity parsing errors
Posted by Paolo Bonzini 7 years, 4 months ago
Coverity does not like the new _Float* types that are used by
recent glibc, and croaks on every single file that includes
stdlib.h.  Add dummy typedefs to please it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
	I've been using this patch for a couple months, and Peter pointed
	out that other projects are doing similar hacks.  So it's probably
	time to send it upstream.

	Note that this is a parse error, so it cannot be fixed in the
	model file.

 include/qemu/osdep.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 9ed62423c0..0084f3fa71 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -33,6 +33,14 @@
 #else
 #include "exec/poison.h"
 #endif
+#ifdef __COVERITY__
+typedef float _Float32;
+typedef double _Float32x;
+typedef double _Float64;
+typedef __float80 _Float64x;
+typedef __float128 _Float128;
+#endif
+
 #include "qemu/compiler.h"
 
 /* Older versions of C++ don't get definitions of various macros from
-- 
2.17.1


Re: [Qemu-devel] [PATCH] osdep: work around Coverity parsing errors
Posted by Peter Maydell 7 years, 4 months ago
On 25 June 2018 at 17:06, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Coverity does not like the new _Float* types that are used by
> recent glibc, and croaks on every single file that includes
> stdlib.h.  Add dummy typedefs to please it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>         I've been using this patch for a couple months, and Peter pointed
>         out that other projects are doing similar hacks.  So it's probably
>         time to send it upstream.
>
>         Note that this is a parse error, so it cannot be fixed in the
>         model file.
>
>  include/qemu/osdep.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 9ed62423c0..0084f3fa71 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -33,6 +33,14 @@
>  #else
>  #include "exec/poison.h"
>  #endif
> +#ifdef __COVERITY__
> +typedef float _Float32;
> +typedef double _Float32x;
> +typedef double _Float64;
> +typedef __float80 _Float64x;
> +typedef __float128 _Float128;
> +#endif

I think it would help to repeat the rationale in a comment here,
to avoid the necessity to dig it out of the git log.

Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

Re: [Qemu-devel] [PATCH] osdep: work around Coverity parsing errors
Posted by Paolo Bonzini 7 years, 4 months ago
On 25/06/2018 18:23, Peter Maydell wrote:
> I think it would help to repeat the rationale in a comment here,
> to avoid the necessity to dig it out of the git log.

Good idea, I'll copy the commit message in there.

Paolo

> Otherwise
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


Re: [Qemu-devel] [PATCH] osdep: work around Coverity parsing errors
Posted by Philippe Mathieu-Daudé 7 years, 4 months ago
On 06/25/2018 01:06 PM, Paolo Bonzini wrote:
> Coverity does not like the new _Float* types that are used by
> recent glibc, and croaks on every single file that includes
> stdlib.h.  Add dummy typedefs to please it.

This matches http://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Floating-Types.html

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
> 	I've been using this patch for a couple months, and Peter pointed
> 	out that other projects are doing similar hacks.  So it's probably
> 	time to send it upstream.
> 
> 	Note that this is a parse error, so it cannot be fixed in the
> 	model file.
> 
>  include/qemu/osdep.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 9ed62423c0..0084f3fa71 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -33,6 +33,14 @@
>  #else
>  #include "exec/poison.h"
>  #endif
> +#ifdef __COVERITY__
> +typedef float _Float32;
> +typedef double _Float32x;
> +typedef double _Float64;
> +typedef __float80 _Float64x;
> +typedef __float128 _Float128;
> +#endif
> +
>  #include "qemu/compiler.h"
>  
>  /* Older versions of C++ don't get definitions of various macros from
>