[Mesa-dev] [PATCH 1/3] glsl: Add convenience function get_sampler_instance

Carl Worth cworth at cworth.org
Thu Dec 4 19:54:46 PST 2014


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:

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

-Carl

-- 
carl.d.worth at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141204/a148934b/attachment.sig>


More information about the mesa-dev mailing list