From 20e996494bda88cf16611987a7acc7652d06fa26 Mon Sep 17 00:00:00 2001 From: Richard Grenville Date: Sun, 6 Sep 2015 22:32:52 +0800 Subject: [PATCH] Misc: Modify function attributes - Remove the const function attribute from get_time_*(), since the functions they call that actually get the time probably access global variables or have other behaviors unacceptable for const functions. - Change the const function attribute on win_has_frame() to pure, as it accesses memory its parameter points to, which is invalid for a const function. --- src/common.h | 4 ++-- src/compton.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.h b/src/common.h index fd6273e..2b75ff7 100644 --- a/src/common.h +++ b/src/common.h @@ -1475,7 +1475,7 @@ timespec_subtract(struct timespec *result, /** * Get current time in struct timeval. */ -static inline struct timeval __attribute__((const)) +static inline struct timeval get_time_timeval(void) { struct timeval tv = { 0, 0 }; @@ -1490,7 +1490,7 @@ get_time_timeval(void) { * * Note its starting time is unspecified. */ -static inline struct timespec __attribute__((const)) +static inline struct timespec get_time_timespec(void) { struct timespec tm = { 0, 0 }; diff --git a/src/compton.h b/src/compton.h index 2070aaf..0e27a75 100644 --- a/src/compton.h +++ b/src/compton.h @@ -500,7 +500,7 @@ update_reg_ignore_expire(session_t *ps, const win *w) { /** * Check whether a window has WM frames. */ -static inline bool __attribute__((const)) +static inline bool __attribute__((pure)) win_has_frame(const win *w) { return w->a.border_width || w->frame_extents.top || w->frame_extents.left