util/atomic: fix return type of p_atomic_add_return() fallback
authorEric Engestrom <eric.engestrom@intel.com>
Sun, 8 Dec 2019 12:52:21 +0000 (12:52 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jan 2020 21:42:52 +0000 (21:42 +0000)
Fixes: 385d13f26d2b69db9423 ("util/atomic: Add a _return variant of p_atomic_add")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3012>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3012>

src/util/u_atomic.h

index 1ad87c8feb1422e979009b652e71492f56dfb575..db56835e9d4f9ba6ed219770849ed1375e624b83 100644 (file)
    sizeof(*v) == sizeof(uint64_t) ? atomic_add_64((uint64_t *)(v), (i)) : \
                                     (assert(!"should not get here"), 0))
 
-#define p_atomic_add_return(v, i) (void) ( \
+#define p_atomic_add_return(v, i) (__typeof(*v)) ( \
    sizeof(*v) == sizeof(uint8_t)  ? atomic_add_8_nv ((uint8_t  *)(v), (i)) : \
    sizeof(*v) == sizeof(uint16_t) ? atomic_add_16_nv((uint16_t *)(v), (i)) : \
    sizeof(*v) == sizeof(uint32_t) ? atomic_add_32_nv((uint32_t *)(v), (i)) : \