From e60c60c1011c7db2cf252670f9d19a2eb90f8889 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Mon, 2 Jul 2012 20:51:20 -0700 Subject: [PATCH] Added macros for handling unused variables. --- include/bx/macros.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/bx/macros.h b/include/bx/macros.h index 35b3ebe..29a1fe1 100644 --- a/include/bx/macros.h +++ b/include/bx/macros.h @@ -29,6 +29,7 @@ # define BX_FUNCTION __PRETTY_FUNCTION__ # define BX_NO_INLINE __attribute__( (noinline) ) # define BX_FORCE_INLINE __extension__ static __inline __attribute__( (__always_inline__) ) +# define BX_ALLOW_UNUSED __attribute__( (unused) ) # if BX_COMPILER_CLANG # define BX_THREAD /* not supported right now */ # else @@ -40,6 +41,7 @@ # define BX_NO_INLINE __declspec(noinline) # define BX_FORCE_INLINE __forceinline # define BX_THREAD __declspec(thread) +# define BX_ALLOW_UNUSED #else # error "Unknown BX_COMPILER_?" #endif @@ -47,6 +49,8 @@ #define BX_ALIGN_STRUCT_16(_struct) BX_ALIGN_STRUCT(16, _struct) #define BX_ALIGN_STRUCT_256(_struct) BX_ALIGN_STRUCT(256, _struct) +#define BX_UNUSED(_unused) do { (void)sizeof(_unused); } while(0) + #ifndef BX_CHECK # define BX_CHECK(...) do {} while(0) #endif // BX_CHECK