Silence unused variable warning in release build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
63dd16ebac
commit
0733f7540f
|
@ -557,8 +557,8 @@ static bool gl_init_blur(struct gl_data *gd, conv *const *const kernels) {
|
|||
char *shader_str = ccalloc(shader_len, char);
|
||||
auto real_shader_len = snprintf(
|
||||
shader_str, shader_len, FRAG_SHADER_BLUR, extension, shader_body, sum);
|
||||
assert(real_shader_len >= 0);
|
||||
assert((size_t)real_shader_len < shader_len);
|
||||
CHECK(real_shader_len >= 0);
|
||||
CHECK((size_t)real_shader_len < shader_len);
|
||||
free(shader_body);
|
||||
|
||||
// Build program
|
||||
|
|
|
@ -41,7 +41,6 @@ safe_isnan(double a) {
|
|||
assert(false); \
|
||||
abort(); \
|
||||
} while (0)
|
||||
|
||||
/// Same as assert, but evaluates the expression even in release builds
|
||||
#define CHECK(expr) \
|
||||
do { \
|
||||
|
@ -51,6 +50,8 @@ safe_isnan(double a) {
|
|||
} while (0)
|
||||
|
||||
// Some macros for checked cast
|
||||
// Note these macros are not complete, as in, they won't work for every integer types. But
|
||||
// they are good enough for compton.
|
||||
|
||||
#define to_int_checked(val) \
|
||||
({ \
|
||||
|
@ -83,9 +84,9 @@ safe_isnan(double a) {
|
|||
#define to_u32_checked(val) \
|
||||
({ \
|
||||
auto tmp = (val); \
|
||||
int64_t max = UINT32_MAX; /* silence clang tautological comparison \
|
||||
warning*/ \
|
||||
assert(tmp >= 0 && tmp <= max); \
|
||||
int64_t max = UINT32_MAX; /* silence clang tautological \
|
||||
comparison warning*/ \
|
||||
CHECK(tmp >= 0 && tmp <= max); \
|
||||
(uint32_t) tmp; \
|
||||
})
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue