mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-21 06:13:08 +01:00
Workaround C4127 MSVC level 4 warning.
This commit is contained in:
@@ -32,6 +32,12 @@ namespace bx
|
||||
}
|
||||
#define BX_ENABLED(_x) bx::isEnabled<!!(_x)>()
|
||||
|
||||
inline bool ignoreC4127(bool _x)
|
||||
{
|
||||
return _x;
|
||||
}
|
||||
#define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) )
|
||||
|
||||
} // namespace bx
|
||||
|
||||
// Annoying C++0x stuff..
|
||||
|
||||
@@ -80,7 +80,11 @@
|
||||
#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_1(_a1) do { (void)(true ? (void)0 : ( (void)(_a1) ) ); } while(0)
|
||||
#define BX_MACRO_BLOCK_BEGIN for(;;) {
|
||||
#define BX_MACRO_BLOCK_END break; }
|
||||
#define BX_NOOP(...) BX_MACRO_BLOCK_BEGIN BX_MACRO_BLOCK_END
|
||||
|
||||
#define BX_UNUSED_1(_a1) BX_MACRO_BLOCK_BEGIN (void)(true ? (void)0 : ( (void)(_a1) ) ); BX_MACRO_BLOCK_END
|
||||
#define BX_UNUSED_2(_a1, _a2) BX_UNUSED_1(_a1); BX_UNUSED_1(_a2)
|
||||
#define BX_UNUSED_3(_a1, _a2, _a3) BX_UNUSED_2(_a1, _a2); BX_UNUSED_1(_a3)
|
||||
#define BX_UNUSED_4(_a1, _a2, _a3, _a4) BX_UNUSED_3(_a1, _a2, _a3); BX_UNUSED_1(_a4)
|
||||
@@ -127,15 +131,15 @@
|
||||
#endif // BX_COMPILER_MSVC
|
||||
|
||||
#ifndef BX_CHECK
|
||||
# define BX_CHECK(_condition, ...) do {} while(0)
|
||||
# define BX_CHECK(_condition, ...) BX_NOOP()
|
||||
#endif // BX_CHECK
|
||||
|
||||
#ifndef BX_TRACE
|
||||
# define BX_TRACE(...) do {} while(0)
|
||||
# define BX_TRACE(...) BX_NOOP()
|
||||
#endif // BX_TRACE
|
||||
|
||||
#ifndef BX_WARN
|
||||
# define BX_WARN(_condition, ...) do {} while(0)
|
||||
# define BX_WARN(_condition, ...) BX_NOOP()
|
||||
#endif // BX_CHECK
|
||||
|
||||
#ifndef BX_CONFIG_ALLOCATOR_DEBUG
|
||||
|
||||
@@ -138,29 +138,6 @@
|
||||
# define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
|
||||
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
|
||||
|
||||
#if BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
|
||||
# pragma warning(error:4062) // ENABLE warning C4062: enumerator'...' in switch of enum '...' is not handled
|
||||
# pragma warning(error:4121) // ENABLE warning C4121: 'symbol' : alignment of a member was sensitive to packing
|
||||
# pragma warning(error:4130) // ENABLE warning C4130: 'operator' : logical operation on address of string constant
|
||||
# pragma warning(error:4239) // ENABLE warning C4239: nonstandard extension used : 'argument' : conversion from '*' to '* &' A non-const reference may only be bound to an lvalue
|
||||
//# pragma warning(error:4244) // ENABLE warning C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
# pragma warning(error:4263) // ENABLE warning C4263: 'function' : member function does not override any base class virtual member function
|
||||
# pragma warning(error:4265) // ENABLE warning C4265: class has virtual functions, but destructor is not virtual
|
||||
# pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
|
||||
# pragma warning(error:4545) // ENABLE warning C4545: expression before comma evaluates to a function which is missing an argument list
|
||||
# pragma warning(error:4549) // ENABLE warning C4549: 'operator' : operator before comma has no effect; did you intend 'operator'?
|
||||
# pragma warning(error:4701) // ENABLE warning C4701: potentially uninitialized local variable 'name' used
|
||||
# pragma warning(error:4706) // ENABLE warning C4706: assignment within conditional expression
|
||||
# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
|
||||
# pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
|
||||
# pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
|
||||
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
|
||||
|
||||
#if BX_COMPILER_CLANG && BX_PLATFORM_LINUX
|
||||
// Clang on Linux complains about missing __float128 type...
|
||||
typedef struct { long double x, y; } __float128;
|
||||
#endif // BX_COMPILER_CLANG && BX_PLATFORM_LINUX
|
||||
|
||||
#if BX_COMPILER_GCC
|
||||
# define BX_COMPILER_NAME "GCC"
|
||||
#elif BX_COMPILER_CLANG
|
||||
@@ -205,4 +182,28 @@ typedef struct { long double x, y; } __float128;
|
||||
# define BX_ARCH_NAME "64-bit"
|
||||
#endif // BX_ARCH_
|
||||
|
||||
#if BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
|
||||
# pragma warning(error:4062) // ENABLE warning C4062: enumerator'...' in switch of enum '...' is not handled
|
||||
# pragma warning(error:4121) // ENABLE warning C4121: 'symbol' : alignment of a member was sensitive to packing
|
||||
//# pragma warning(error:4127) // ENABLE warning C4127: conditional expression is constant
|
||||
# pragma warning(error:4130) // ENABLE warning C4130: 'operator' : logical operation on address of string constant
|
||||
# pragma warning(error:4239) // ENABLE warning C4239: nonstandard extension used : 'argument' : conversion from '*' to '* &' A non-const reference may only be bound to an lvalue
|
||||
//# pragma warning(error:4244) // ENABLE warning C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
# pragma warning(error:4263) // ENABLE warning C4263: 'function' : member function does not override any base class virtual member function
|
||||
# pragma warning(error:4265) // ENABLE warning C4265: class has virtual functions, but destructor is not virtual
|
||||
# pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
|
||||
# pragma warning(error:4545) // ENABLE warning C4545: expression before comma evaluates to a function which is missing an argument list
|
||||
# pragma warning(error:4549) // ENABLE warning C4549: 'operator' : operator before comma has no effect; did you intend 'operator'?
|
||||
# pragma warning(error:4701) // ENABLE warning C4701: potentially uninitialized local variable 'name' used
|
||||
# pragma warning(error:4706) // ENABLE warning C4706: assignment within conditional expression
|
||||
# pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
|
||||
# pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
|
||||
# pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
|
||||
#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
|
||||
|
||||
#if BX_COMPILER_CLANG && BX_PLATFORM_LINUX
|
||||
// Clang on Linux complains about missing __float128 type...
|
||||
typedef struct { long double x, y; } __float128;
|
||||
#endif // BX_COMPILER_CLANG && BX_PLATFORM_LINUX
|
||||
|
||||
#endif // BX_PLATFORM_H_HEADER_GUARD
|
||||
|
||||
Reference in New Issue
Block a user