[Mesa-dev] [Bug 93189] "./util/u_inlines.h", line 83: operands have incompatible types: void ":" int

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Dec 1 11:39:49 PST 2015


https://bugs.freedesktop.org/show_bug.cgi?id=93189

--- Comment #5 from Ian Romanick <idr at freedesktop.org> ---
(In reply to Jose Fonseca from comment #2)
> Vinson, Alan,
> 
> 
> If Oracle itself has no interest on building Mesa with Solaris Sudio
> component, let's save everybody's time by making that dependency crystal
> clear.

I would tend to agree, but I looked at the code in question:

define p_atomic_inc(v) (void) (\
   sizeof(*v) == sizeof(uint8_t)  ? atomic_inc_8 ((uint8_t  *)(v)) : \
   sizeof(*v) == sizeof(uint16_t) ? atomic_inc_16((uint16_t *)(v)) : \
   sizeof(*v) == sizeof(uint32_t) ? atomic_inc_32((uint32_t *)(v)) : \
   sizeof(*v) == sizeof(uint64_t) ? atomic_inc_64((uint64_t *)(v)) : \
                                    (assert(!"should not get here"), 0))

I don't think that would build on any compiler... and it doesn't seem that hard
to fix.

static inline _p_atomic_inc(void *v, size_t s)
{
    assert(s == sizeof(uint8_t) ||
           s == sizeof(uint16_t) ||
           s == sizeof(uint32_t) ||
           s == sizeof(uint64_t));

    switch (s) {
    case sizeof(uint8_t):  atomic_inc_8 ((uint8_t  *)(v)); break;
    case sizeof(uint16_t): atomic_inc_16((uint16_t *)(v)); break;
    case sizeof(uint32_t): atomic_inc_32((uint32_t *)(v)); break;
    case sizeof(uint64_t): atomic_inc_64((uint64_t *)(v)); break;
    default: unreachable("Bad size");
    }
}

#define p_atomic_inc(v) _p_atomic_inc(v, sizeof(*v))

One could probably create a macro or two to generate the other functions.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151201/c61f453a/attachment.html>


More information about the mesa-dev mailing list