X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fcompiler%2Fcompiler.h;h=1e0d8efbaacc1be66aa291f861560a513b69887a;hp=d57d814b3711213c978602cd46c7c6e2e67ccf7d;hb=737eacb13ce9550f9820cbc55eec8b38fa2fa6a4;hpb=1c005e1223d2f8f664ce4b3be6cd7eb4dd449844 diff --git a/ccan/compiler/compiler.h b/ccan/compiler/compiler.h index d57d814b..1e0d8efb 100644 --- a/ccan/compiler/compiler.h +++ b/ccan/compiler/compiler.h @@ -20,6 +20,24 @@ #define COLD #endif +#if HAVE_ATTRIBUTE_NORETURN +/** + * NORETURN - a function does not return + * + * Used to mark a function which exits; useful for suppressing warnings. + * + * Example: + * static void NORETURN fail(const char *reason) + * { + * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); + * exit(1); + * } + */ +#define NORETURN __attribute__((noreturn)) +#else +#define NORETURN +#endif + #if HAVE_ATTRIBUTE_PRINTF /** * PRINTF_FMT - a function takes printf-style arguments