From 70b32490063a227e48fe06ec2e0e2c976b6eff12 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 24 Oct 2022 18:02:18 -0700 Subject: usage: add cold & noreturn attributes to function As suggested by clang: xlsclients.c:69:1: warning: function 'usage' could be declared with attribute 'noreturn' [-Wmissing-noreturn] { ^ Signed-off-by: Alan Coopersmith --- xlsclients.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xlsclients.c b/xlsclients.c index 0fbe1cf..94ee214 100644 --- a/xlsclients.c +++ b/xlsclients.c @@ -48,6 +48,10 @@ in this Software without prior written authorization from The Open Group. #define PRIu32 "u" #endif +#ifndef __has_attribute +# define __has_attribute(x) 0 /* Compatibility with older compilers. */ +#endif + static char *ProgramName; static xcb_atom_t WM_STATE; @@ -64,7 +68,13 @@ typedef int Bool; #define False (0) #define True (!False) -static void +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