[PATCH:luit] Add additional printf & noreturn attributes suggested by gcc warnings

Alan Coopersmith alan.coopersmith at oracle.com
Fri Feb 10 19:49:38 PST 2012


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 luit.h |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/luit.h b/luit.h
index ccb1701..fb8b946 100644
--- a/luit.h
+++ b/luit.h
@@ -30,17 +30,25 @@ extern int sevenbit;
 extern int ilog;
 extern int olog;
 
-void child(char *, char *, char *const *);
-void parent(int, int);
-
-void ErrorF(const char *f,...);
-
-/* Not using _X_NORETURN since that would pull in extra dependencies */
+/* Not using Xfuncproto.h since that would pull in extra dependencies */
 #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
         || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-void FatalError(const char *f,...) __attribute((noreturn));
+# define LUIT_NORETURN __attribute__((noreturn))
 #else
-void FatalError(const char *f,...);
+# define LUIT_NORETURN /* nothing */
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+# define LUIT_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
+#else /* not gcc >= 2.3 */
+# define LUIT_PRINTF(x,y) /* nothing */
 #endif
 
+void child(char *, char *, char *const *) LUIT_NORETURN;
+void parent(int, int);
+
+void ErrorF(const char *f,...) LUIT_PRINTF(1,2);
+
+void FatalError(const char *f,...) LUIT_NORETURN LUIT_PRINTF(1,2);
+
 #endif /* LUIT_LUIT_H */
-- 
1.7.3.2



More information about the xorg-devel mailing list