From ab1dce3cee49f0c497b158a2a2dd3412d531e154 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 22 Oct 2022 13:09:18 -0700 Subject: usage: add cold & noreturn attributes to function As suggested by clang: xlsatoms.c:56:1: warning: function 'usage' could be declared with attribute 'noreturn' [-Wmissing-noreturn] { ^ Signed-off-by: Alan Coopersmith --- xlsatoms.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xlsatoms.c b/xlsatoms.c index 6c7f4b5..1dbe1e9 100644 --- a/xlsatoms.c +++ b/xlsatoms.c @@ -51,7 +51,17 @@ static void do_range ( xcb_connection_t *c, const char *format, char *range ); static void list_atoms ( xcb_connection_t *c, const char *format, int mask, xcb_atom_t low, xcb_atom_t high ); -static void +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with older compilers. */ +#endif + +static void +#if __has_attribute(__cold__) +__attribute__((__cold__)) +#endif +#if __has_attribute(noreturn) +__attribute__((noreturn)) +#endif usage(const char *errmsg) { if (errmsg != NULL) -- cgit v1.2.3