Quoth [email protected],

A little remark about this patch: Actually the right way to fix
this warning would be to add this attribute in src/funcs.h: void
Exit(int status) __attribute__ ((noreturn));

  Brad Jorsch independently proposed the above.

However, I do not propose a patch with this as this is a GNU
extension in GCC, so I is may fail with other compilers, and I do
not know the right macros to have it set in compliance with
autotool's configure's detection.

  And he pointed out that there's already some preprocessor trickery
to hide __attribute__ from other compilers. I traced through the #include chain and concluded that it will indeed be eventually included by funcs.h.

  Therefore a patch is probably safe.
From 9b4026cf0e10ef6fbb42db335d34928b426308d9 Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Tue, 10 Apr 2012 10:55:26 +0100
Subject: [PATCH 3/3] Use noreturn attribute in Exit() declaration.

Use the gcc-specific noreturn attribute to advise the compiler that
Exit() doesn't return.  This is safe because we already use preprocessor
rules to hide __attribute__ from other compilers.

Suggested independently by Christophe Curis and Brad Jorsch.
---
 src/funcs.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/funcs.h b/src/funcs.h
index ce9a99d..f64a40f 100644
--- a/src/funcs.h
+++ b/src/funcs.h
@@ -35,7 +35,7 @@ void Shutdown(WShutdownMode mode);
 
 void RestoreDesktop(WScreen *scr);
 
-void Exit(int status);
+void Exit(int status) __attribute__((noreturn));
 
 void Restart(char *manager, Bool abortOnFailure);
 
-- 
1.7.7.6

Reply via email to