Browse Source

gallium: add STATIC_ASSERT macro

tags/mesa-8.0-rc1
Brian Paul 13 years ago
parent
commit
188aca3492
1 changed files with 11 additions and 0 deletions
  1. 11
    0
      src/gallium/include/pipe/p_compiler.h

+ 11
- 0
src/gallium/include/pipe/p_compiler.h View File

@@ -308,6 +308,17 @@ void _ReadWriteBarrier(void);
#endif


/**
* Static (compile-time) assertion.
* Basically, use COND to dimension an array. If COND is false/zero the
* array size will be -1 and we'll get a compilation error.
*/
#define STATIC_ASSERT(COND) \
do { \
typedef int static_assertion_failed[(!!(COND))*2-1]; \
} while (0)


#if defined(__cplusplus)
}
#endif

Loading…
Cancel
Save