summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-24 18:02:18 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-24 18:02:18 -0700
commit70b32490063a227e48fe06ec2e0e2c976b6eff12 (patch)
tree8c1bf6d1637a284cd640e7436b58927573e4fd7b
parent99c7b421dbd083c3c16158982eabb28758868188 (diff)
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 <alan.coopersmith@oracle.com>
-rw-r--r--xlsclients.c12
1 files changed, 11 insertions, 1 deletions
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)