Browse Source

Apply noreturn and printf-format attributes to quit() function definition

Luke Dashjr 12 years ago
parent
commit
19dc859dc4
2 changed files with 8 additions and 2 deletions
  1. 7 1
      configure.ac
  2. 1 1
      miner.h

+ 7 - 1
configure.ac

@@ -530,8 +530,14 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(vo
 			  AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
                                     [Define if __attribute__((const))]))
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
+	[
 			  AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
-                                    [Define if __attribute__((noreturn))]))
+                                    [Define if __attribute__((noreturn))])
+		AC_DEFINE_UNQUOTED([NORETURN], [__attribute__((noreturn))], [Syntax of noreturn attribute])
+	], [
+		AC_DEFINE_UNQUOTED([NORETURN], [])
+	]
+)
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
 			  AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
                                     [Define if __attribute__((format(__printf__)))]))

+ 1 - 1
miner.h

@@ -684,7 +684,7 @@ static inline void swab256(void *dest_p, const void *src_p)
 
 #define flip32(dest_p, src_p) swap32yes(dest_p, src_p, 32 / 4)
 
-extern void quit(int status, const char *format, ...);
+extern void quit(int status, const char *format, ...) NORETURN FORMAT_SYNTAX_CHECK(printf, 2, 3);
 
 static inline void mutex_lock(pthread_mutex_t *lock)
 {