From f6b7a7f974c3eaadc9d4705d61780de6a7009854 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 8 Aug 2016 11:58:50 +0200 Subject: [PATCH] cli: add noreturn attributes Teach static code analyzers (such as Clang static analyzer) that code following nl_cli_fatal can never be executed. Avoids false positives such as detecting use of NULL pointers when that cannot happen. Signed-off-by: Peter Wu Signed-off-by: Thomas Haller --- include/netlink/cli/utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/netlink/cli/utils.h b/include/netlink/cli/utils.h index ea89fc6..4c28343 100644 --- a/include/netlink/cli/utils.h +++ b/include/netlink/cli/utils.h @@ -61,8 +61,10 @@ extern "C" { #endif extern uint32_t nl_cli_parse_u32(const char *); -extern void nl_cli_print_version(void); -extern void nl_cli_fatal(int, const char *, ...); +extern void nl_cli_print_version(void) + __attribute__((noreturn)); +extern void nl_cli_fatal(int, const char *, ...) + __attribute__((noreturn)); extern struct nl_addr * nl_cli_addr_parse(const char *, int); extern int nl_cli_connect(struct nl_sock *, int); extern struct nl_sock * nl_cli_alloc_socket(void); -- 2.40.0