Added the gcc attribute noreturn to a few functions that could use it
(but only if the compiler is gcc 2.5 >=), and added the warning to
point out when a function should use noreturn.
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@791
64e312b2-a51f-0410-8e61-
82d0ca0eb02a
AX_CFLAGS_ADD([-Wmissing-include-dirs])
AX_CFLAGS_ADD([-Wswitch-default])
AX_CFLAGS_ADD([-Wunknown-pragmas])
-
+AX_CFLAGS_ADD([-Wmissing-noreturn])
AC_CHECK_PROGS(GCOV, gcov, false)
AC_CHECK_PROGS(LCOV, lcov, false)
#define CK_ATTRIBUTE_UNUSED
#endif /* GCC 2.95 */
+#if GCC_VERSION_AT_LEAST(2,5)
+#define CK_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
+#else
+#define CK_ATTRIBUTE_NORETURN
+#endif /* GCC 2.5 */
+
/* defines size_t */
#include <sys/types.h>
#endif /* HAVE_STDARG_H */
/* silence warnings about an empty library */
-void ck_do_nothing (void);
+void ck_do_nothing (void) CK_ATTRIBUTE_NORETURN;
#endif /* !LIBCOMPAT_H */
#define CK_ATTRIBUTE_UNUSED
#endif /* GCC 2.95 */
+#if GCC_VERSION_AT_LEAST(2,5)
+#define CK_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
+#else
+#define CK_ATTRIBUTE_NORETURN
+#endif /* GCC 2.5 */
+
#include <sys/types.h>
/* Used to create the linker script for hiding lib-local symbols. Shall
pid_t CK_EXPORT check_fork(void);
/* Wait for the pid and exit. If pid is zero, just exit. */
-void CK_EXPORT check_waitpid_and_exit(pid_t pid);
+void CK_EXPORT check_waitpid_and_exit(pid_t pid) CK_ATTRIBUTE_NORETURN;
#ifdef __cplusplus
CK_CPPEND
#ifndef ERROR_H
#define ERROR_H
+#include "../lib/libcompat.h"
#include <setjmp.h>
extern jmp_buf error_jmp_buffer;
/* Print error message and die
If fmt ends in colon, include system error information */
-void eprintf (const char *fmt, const char *file, int line,...);
+void eprintf (const char *fmt, const char *file, int line,...) CK_ATTRIBUTE_NORETURN;
/* malloc or die */
void *emalloc(size_t n);
void *erealloc(void *, size_t n);