Commit b3122d5d authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

warn about unused return values

parent 7f356d91
......@@ -41,10 +41,12 @@
/** Static list initialization */
#define LIST_INIT_STATIC(l) \
__attribute__((constructor(105))) static void UNIQUE(__ctor)() {\
vlist_init(l); \
int ret __attribute__((unused)); \
ret = vlist_init(l); \
} \
__attribute__((destructor(105))) static void UNIQUE(__dtor)() { \
vlist_destroy(l, nullptr, false); \
int ret __attribute__((unused)); \
ret = vlist_destroy(l, nullptr, false); \
}
#define vlist_length(list) ((list)->length)
......@@ -70,7 +72,7 @@ struct vlist {
*
* @param l A pointer to the list data structure.
*/
int vlist_init(struct vlist *l);
int vlist_init(struct vlist *l) __attribute__ ((warn_unused_result));
/** Destroy a list and call destructors for all list elements
*
......@@ -78,7 +80,7 @@ int vlist_init(struct vlist *l);
* @param dtor A function pointer to a desctructor which will be called for every list item when the list is destroyed.
* @param l A pointer to the list data structure.
*/
int vlist_destroy(struct vlist *l, dtor_cb_t dtor = nullptr, bool free = false);
int vlist_destroy(struct vlist *l, dtor_cb_t dtor = nullptr, bool free = false) __attribute__ ((warn_unused_result));
/** Append an element to the end of the list */
void vlist_push(struct vlist *l, void *p);
......
......@@ -95,6 +95,6 @@ static uint64_t tsc_now(struct tsc *t)
: rdtsc();
}
int tsc_init(struct tsc *t);
int tsc_init(struct tsc *t) __attribute__ ((warn_unused_result));
uint64_t tsc_rate_to_cycles(struct tsc *t, double rate);
......@@ -137,7 +137,7 @@ assertExcept(bool condition, const T &exception)
}
/** Register a exit callback for program termination: SIGINT, SIGKILL & SIGALRM. */
int signals_init(void (*cb)(int signal, siginfo_t *sinfo, void *ctx), std::list<int> cbSignals = {}, std::list<int> ignoreSignals = { SIGCHLD });
int signals_init(void (*cb)(int signal, siginfo_t *sinfo, void *ctx), std::list<int> cbSignals = {}, std::list<int> ignoreSignals = { SIGCHLD }) __attribute__ ((warn_unused_result));
/** Fill buffer with random data */
ssize_t read_random(char *buf, size_t len);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment