On Thu, Dec 4, 2014 at 7:54 PM, Carl Worth <cwo...@cworth.org> wrote:
> On Thu, Dec 04 2014, Carl Worth wrote:
>> So I think I'll follow up with a separate patch to clean these up.
>
> Before I do that, I noticed the following in util/macros.h:
>
>         /**
>          * Unreachable macro. Useful for suppressing "control reaches end of 
> non-void
>          * function" warnings.
>          */
>         #ifdef HAVE___BUILTIN_UNREACHABLE
>         #define unreachable(str)    \
>         do {                        \
>            assert(!str);            \
>            __builtin_unreachable(); \
>         } while (0)
>         #elif _MSC_VER >= 1200
>         #define unreachable(str)    \
>         do {                        \
>            assert(!str);            \
>            __assume(0);             \
>         } while (0)
>         #endif
>
>         #ifndef unreachable
>         #define unreachable(str)
>         #endif
>
> I don't know under what conditions HAVE___BUILTIN_UNREACHABLE might not
> be defined. But in the final fallback below shouldn't we at least define
> unreachable to use assert:

__builtin_unreachable() is available in gcc >= 4.5 and unknown
versions of clang.

>
>         #ifndef unreachable
>         #define unreachable(str) assert(!str)
>         #endif

Seems like a good idea.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to