mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
utils: try to avoid variable shadowing in some macros
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
45ffdf9849
commit
9175489f65
1 changed files with 7 additions and 6 deletions
11
src/utils.h
11
src/utils.h
|
@ -58,11 +58,11 @@ safe_isnan(double a) {
|
||||||
/// being always true or false.
|
/// being always true or false.
|
||||||
#define ASSERT_IN_RANGE(var, lower, upper) \
|
#define ASSERT_IN_RANGE(var, lower, upper) \
|
||||||
do { \
|
do { \
|
||||||
auto __tmp attr_unused = (var); \
|
auto __assert_in_range_tmp attr_unused = (var); \
|
||||||
_Pragma("GCC diagnostic push"); \
|
_Pragma("GCC diagnostic push"); \
|
||||||
_Pragma("GCC diagnostic ignored \"-Wtype-limits\""); \
|
_Pragma("GCC diagnostic ignored \"-Wtype-limits\""); \
|
||||||
assert(__tmp >= lower); \
|
assert(__assert_in_range_tmp >= lower); \
|
||||||
assert(__tmp <= upper); \
|
assert(__assert_in_range_tmp <= upper); \
|
||||||
_Pragma("GCC diagnostic pop"); \
|
_Pragma("GCC diagnostic pop"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -112,9 +112,10 @@ safe_isnan(double a) {
|
||||||
#define to_u32_checked(val) \
|
#define to_u32_checked(val) \
|
||||||
({ \
|
({ \
|
||||||
auto __to_tmp = (val); \
|
auto __to_tmp = (val); \
|
||||||
int64_t max attr_unused = UINT32_MAX; /* silence clang tautological \
|
int64_t __to_u32_max attr_unused = UINT32_MAX; /* silence clang \
|
||||||
|
tautological \
|
||||||
comparison warning */ \
|
comparison warning */ \
|
||||||
ASSERT_IN_RANGE(__to_tmp, 0, max); \
|
ASSERT_IN_RANGE(__to_tmp, 0, __to_u32_max); \
|
||||||
(uint32_t) __to_tmp; \
|
(uint32_t) __to_tmp; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue