mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:44:12 +08:00
mdbx: fixes for modern Coverity.
This resolves https://github.com/leo-yuriev/libmdbx/issues/81 Change-Id: Id501bf49055b54240da14723aef0115fc3a27672
This commit is contained in:
parent
7ea1a4e0e8
commit
c1ad86c368
@ -751,7 +751,9 @@ static __always_inline bool atomic_cas64(volatile uint64_t *p, uint64_t c,
|
||||
uint64_t v) {
|
||||
#if defined(ATOMIC_VAR_INIT) || defined(ATOMIC_LLONG_LOCK_FREE)
|
||||
STATIC_ASSERT(sizeof(long long) >= sizeof(uint64_t));
|
||||
#ifndef __COVERITY__
|
||||
STATIC_ASSERT(atomic_is_lock_free(p));
|
||||
#endif /* Workaround for Coverity */
|
||||
return atomic_compare_exchange_strong((_Atomic uint64_t *)p, &c, v);
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
return __sync_bool_compare_and_swap(p, c, v);
|
||||
@ -770,7 +772,9 @@ static __always_inline bool atomic_cas32(volatile uint32_t *p, uint32_t c,
|
||||
uint32_t v) {
|
||||
#if defined(ATOMIC_VAR_INIT) || defined(ATOMIC_INT_LOCK_FREE)
|
||||
STATIC_ASSERT(sizeof(int) >= sizeof(uint32_t));
|
||||
#ifndef __COVERITY__
|
||||
STATIC_ASSERT(atomic_is_lock_free(p));
|
||||
#endif /* Workaround for Coverity */
|
||||
return atomic_compare_exchange_strong((_Atomic uint32_t *)p, &c, v);
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
return __sync_bool_compare_and_swap(p, c, v);
|
||||
@ -787,7 +791,9 @@ static __always_inline bool atomic_cas32(volatile uint32_t *p, uint32_t c,
|
||||
static __always_inline uint32_t atomic_add32(volatile uint32_t *p, uint32_t v) {
|
||||
#if defined(ATOMIC_VAR_INIT) || defined(ATOMIC_INT_LOCK_FREE)
|
||||
STATIC_ASSERT(sizeof(int) >= sizeof(uint32_t));
|
||||
#ifndef __COVERITY__
|
||||
STATIC_ASSERT(atomic_is_lock_free(p));
|
||||
#endif /* Workaround for Coverity */
|
||||
return atomic_fetch_add((_Atomic uint32_t *)p, v);
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
return __sync_fetch_and_add(p, v);
|
||||
|
@ -309,17 +309,6 @@
|
||||
# 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 */
|
||||
|
||||
#ifndef __printf_args
|
||||
# if defined(__GNUC__) || __has_attribute(__format__)
|
||||
# define __printf_args(format_index, first_arg) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user