From b4434778697628e159a5f59c89b19557703efaf4 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 28 May 2019 21:19:54 +0300 Subject: [PATCH] mdbx: workaround for Coverity Scan. Change-Id: I0e2d22bbbd38ac7978fb8879219ded79a5be1b0a --- src/defs.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/defs.h b/src/defs.h index 024322a1..a672b8bd 100644 --- a/src/defs.h +++ b/src/defs.h @@ -303,7 +303,7 @@ #endif /* __flatten */ #ifndef likely -# if defined(__GNUC__) || defined(__clang__) +# if (defined(__GNUC__) || defined(__clang__)) && !defined(__COVERITY__) # define likely(cond) __builtin_expect(!!(cond), 1) # else # define likely(x) (x) @@ -311,13 +311,24 @@ #endif /* likely */ #ifndef unlikely -# if defined(__GNUC__) || defined(__clang__) +# if (defined(__GNUC__) || defined(__clang__)) && !defined(__COVERITY__) # define unlikely(cond) __builtin_expect(!!(cond), 0) # else # define unlikely(x) (x) # endif #endif /* unlikely */ +/* Workaround for Coverity Scan */ +#if defined(__COVERITY__) && __GNUC_PREREQ(7, 0) && !defined(__cplusplus) +typedef float _Float32; +typedef double _Float32x; +typedef double _Float64; +typedef long double _Float64x; +typedef float _Float128 __attribute__((__mode__(__TF__))); +typedef __complex__ float __cfloat128 __attribute__ ((__mode__ (__TC__))); +typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); +#endif /* Workaround for Coverity Scan */ + /* Wrapper around __func__, which is a C99 feature */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L # define mdbx_func_ __func__