mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Add NXT_UNUSED to silence unused warnings
This commit is contained in:
committed by
Corentin Wallez
parent
5ab96e0d40
commit
82565b340f
@@ -55,7 +55,7 @@
|
||||
# else
|
||||
# define NXT_ASSERT_CALLSITE_HELPER(file, func, line, condition) \
|
||||
do { \
|
||||
(void)sizeof(condition); \
|
||||
NXT_UNUSED(sizeof(condition)); \
|
||||
} while (NXT_ASSERT_LOOP_CONDITION)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
// - NXT_NO_DISCARD: An attribute that is C++17 [[nodiscard]] where available
|
||||
// - NXT_(UN)?LIKELY(EXPR): Where available, hints the compiler that the expression will be true
|
||||
// (resp. false) to help it generate code that leads to better branch prediction.
|
||||
// - NXT_UNUSED(EXPR): Prevents unused variable/expression warnings on EXPR.
|
||||
|
||||
// Clang and GCC
|
||||
#if defined(__GNUC__)
|
||||
@@ -72,6 +73,9 @@ extern void __cdecl __debugbreak(void);
|
||||
# error "Unsupported compiler"
|
||||
#endif
|
||||
|
||||
// It seems that (void) EXPR works on all compilers to silence the unused variable warning.
|
||||
#define NXT_UNUSED(EXPR) (void)EXPR
|
||||
|
||||
// Add noop replacements for macros for features that aren't supported by the compiler.
|
||||
#if !defined(NXT_LIKELY)
|
||||
# define NXT_LIKELY(X) X
|
||||
|
||||
Reference in New Issue
Block a user