From 4976d48b6f3a64d1b6dd71e11d13669e77a73c67 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Fri, 15 Nov 2013 18:46:40 +0100 Subject: [PATCH] WINGs: Added attribute 'noreturn' to public function 'WMScreenMainLoop' As suggested by GCC, this function is a good candidate. There is a little constraint on how to do it however, as it is part of the public API so we have to do it in a portable fashion (We can't rely on our "config.h" when the file will have been installed). Signed-off-by: Christophe CURIS --- WINGs/WINGs/WINGs.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h index 0104e03e..d3b4f285 100644 --- a/WINGs/WINGs/WINGs.h +++ b/WINGs/WINGs/WINGs.h @@ -26,7 +26,7 @@ #include #include -#define WINGS_H_VERSION 20041030 +#define WINGS_H_VERSION 20131115 #ifdef __cplusplus @@ -37,6 +37,22 @@ extern "C" { #endif +#ifdef __STDC_VERSION__ +# if __STDC_VERSION__ >= 201112L +/* + * Ideally, we would like to include the proper header to have 'noreturn' properly + * defined (that's what is done for the rest of the code) + * However, as we're a public API file we can't do that in a portable fashion, so + * we just stick to plain STD C11 keyword + */ +# define _wings_noreturn _Noreturn +# else +# define _wings_noreturn /**/ +# endif +#else +#define _wings_noreturn /**/ +#endif + typedef unsigned long WMPixel; @@ -648,7 +664,7 @@ WMScreen* WMCreateScreen(Display *display, int screen); WMScreen* WMCreateSimpleApplicationScreen(Display *display); -void WMScreenMainLoop(WMScreen *scr); +_wings_noreturn void WMScreenMainLoop(WMScreen *scr); void WMBreakModalLoop(WMScreen *scr); @@ -1859,5 +1875,9 @@ void W_setconf_doubleClickDelay(int value); } #endif /* __cplusplus */ -#endif +/* These definitions are not meant to be seen outside this file */ +#undef _wings_noreturn + + +#endif