Fix compiler warnings in release builds

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-10-12 15:12:17 +01:00
parent 065f9ffd4d
commit 583cf35bed
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
4 changed files with 8 additions and 8 deletions

View File

@ -249,7 +249,7 @@ static inline int strcmp_wd(const char *needle, const char *src) {
/**
* Return whether a c2_ptr_t is empty.
*/
static inline bool c2_ptr_isempty(const c2_ptr_t p) {
static inline attr_unused bool c2_ptr_isempty(const c2_ptr_t p) {
return !(p.isbranch ? (bool)p.b : (bool)p.l);
}

View File

@ -134,7 +134,7 @@ static inline bool ensure_glx_context(session_t *ps) {
/**
* Free a GLX texture.
*/
static inline void free_texture_r(session_t *ps, GLuint *ptexture) {
static inline void free_texture_r(session_t *ps attr_unused, GLuint *ptexture) {
if (*ptexture) {
assert(glx_has_context(ps));
glDeleteTextures(1, ptexture);

View File

@ -57,7 +57,7 @@ safe_isnan(double a) {
/// being always true or false.
#define ASSERT_IN_RANGE(var, lower, upper) \
do { \
auto __tmp = (var); \
auto __tmp attr_unused = (var); \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\""); \
assert(__tmp >= lower); \
@ -69,7 +69,7 @@ safe_isnan(double a) {
/// being always true or false.
#define ASSERT_GEQ(var, lower) \
do { \
auto __tmp = (var); \
auto __tmp attr_unused = (var); \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\""); \
assert(__tmp >= lower); \
@ -111,7 +111,7 @@ safe_isnan(double a) {
#define to_u32_checked(val) \
({ \
auto tmp = (val); \
int64_t max = UINT32_MAX; /* silence clang tautological \
int64_t max attr_unused = UINT32_MAX; /* silence clang tautological \
comparison warning*/ \
ASSERT_IN_RANGE(tmp, 0, max); \
(uint32_t) tmp; \

View File

@ -329,8 +329,7 @@ void win_release_images(struct backend_base *backend, struct managed_win *w) {
void win_process_flags(session_t *ps, struct managed_win *w) {
// Make sure all pending window updates are processed before this. Making this
// assumption simplifies some checks (e.g. whether window is mapped)
auto iw = (struct managed_win_internal *)w;
assert(iw->pending_updates == 0);
assert(((struct managed_win_internal *)w)->pending_updates == 0);
if (!w->flags || (w->flags & WIN_FLAGS_IMAGE_ERROR) != 0) {
return;
@ -2250,6 +2249,7 @@ win_is_fullscreen_xcb(xcb_connection_t *c, const struct atom *a, const xcb_windo
void win_queue_update(struct managed_win *_w, enum win_update update) {
auto w = (struct managed_win_internal *)_w;
assert(popcount(update) == 1);
assert(update == WIN_UPDATE_MAP); // Currently the only supported update
if (unlikely(_w->state == WSTATE_DESTROYING)) {
log_error("Updates queued on a destroyed window %#010x (%s)", _w->base.id,
@ -2257,7 +2257,7 @@ void win_queue_update(struct managed_win *_w, enum win_update update) {
return;
}
w->pending_updates |= WIN_UPDATE_MAP;
w->pending_updates |= update;
}
/// Process pending updates on a window. Has to be called in X critical section