[winpr,assert] silence -Wtautological-value-range-compare
assertions sometimes check for values that are not possible (checks in defines that are used on different types, ...) so silence these warnings.
This commit is contained in:
parent
88d9b1f110
commit
0a02afc225
@ -39,6 +39,7 @@ extern "C"
|
||||
{ \
|
||||
WINPR_PRAGMA_DIAG_PUSH \
|
||||
WINPR_PRAGMA_DIAG_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE \
|
||||
WINPR_PRAGMA_DIAG_TAUTOLOGICAL_VALUE_RANGE_COMPARE \
|
||||
if (!(cond)) \
|
||||
winpr_int_assert(#cond, __FILE__, __func__, __LINE__); \
|
||||
WINPR_PRAGMA_DIAG_POP \
|
||||
@ -58,7 +59,15 @@ extern "C"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define WINPR_ASSERT(cond) assert(cond)
|
||||
#define WINPR_ASSERT(cond) \
|
||||
do \
|
||||
{ \
|
||||
WINPR_PRAGMA_DIAG_PUSH \
|
||||
WINPR_PRAGMA_DIAG_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE \
|
||||
WINPR_PRAGMA_DIAG_TAUTOLOGICAL_VALUE_RANGE_COMPARE \
|
||||
assert(cond); \
|
||||
WINPR_PRAGMA_DIAG_POP \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -87,6 +87,12 @@
|
||||
version \
|
||||
3.9.0 \
|
||||
*/
|
||||
#define WINPR_PRAGMA_DIAG_TAUTOLOGICAL_VALUE_RANGE_COMPARE \
|
||||
_Pragma( \
|
||||
"clang diagnostic ignored \"-Wtautological-value-range-compare\"") /** @since \
|
||||
version \
|
||||
3.10.0 \
|
||||
*/
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_NONLITERAL \
|
||||
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"") /** @since version 3.9.0 */
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC /** @since version 3.3.0 */ /* not supported \
|
||||
@ -119,6 +125,8 @@
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-security\"")
|
||||
#define WINPR_PRAGMA_DIAG_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE /* not supported
|
||||
_Pragma("GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"") */ /** @since version 3.9.0 */
|
||||
#define WINPR_PRAGMA_DIAG_TAUTOLOGICAL_VALUE_RANGE_COMPARE /* not supported
|
||||
_Pragma("GCC diagnostic ignored \"-Wtautological-value-range-compare\"") */ /** @since version 3.10.0 */
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_NONLITERAL \
|
||||
_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") /** @since version 3.9.0 */
|
||||
#if __GNUC__ >= 11
|
||||
@ -144,6 +152,7 @@
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_UNUSED_CONST_VAR
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_SECURITY
|
||||
#define WINPR_PRAGMA_DIAG_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE /** @since version 3.9.0 */
|
||||
#define WINPR_PRAGMA_DIAG_TAUTOLOGICAL_VALUE_RANGE_COMPARE /** @since version 3.10.0 */
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_FORMAT_NONLITERAL /** @since version 3.9.0 */
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC /** @since version 3.3.0 */
|
||||
#define WINPR_PRAGMA_DIAG_POP
|
||||
|
Loading…
Reference in New Issue
Block a user